What is the difference with Canon EF-S and EF-M lens?
The difference is in the flange focal distance, i.e. the distance between the mounting flange for the lens and the film/sensor.
Canon's EF-M has an 18mm flange focal distance, compared to 44mm for the EF and EF-S systems. That is, the lens is effectively 26mm closer to the sensor on the EF-M cameras, thanks to not having a reflex mirror, so not needing to leave space for it.
Advantages / Disadvantages
The benefit of a shorter distance is physically smaller optics, so EF-M lenses can be smaller and lighter for the same specifications (focal length & aperture), and thus cheaper too. Just take a look at the EF-M 22mm f/2 STM 'pancake' (105g, 24mm long) compared to 20mm or 24mm lenses designed for the EF mount; even f/2.8 lenses around that focal length are much bigger (closest is about 270g, 49mm long).
The downside is that there's not (yet?) many lenses for the EF-M mount, though other lenses can be attached with an appropriate adaptor.
Mounting other lenses on an EF-M camera
Cameras with a shorter flange focal distance also allow lenses designed for longer flange focal distances to be attached with only a very simple 'spacer' adaptor, no extra optics are required since the lens simply has to be positioned further from the sensor/film. However cameras with a longer flange focal distance require adaptors with correcting optics to mount lenses designed for a shorter flange focal distance.
For example, the EF-M adaptor (allowing EF and EF-S lenses to be attached to an EF-M camera) simply adds the missing 26mm spacing so the EF/EF-S lens is 44mm from the sensor. Only physical/electrical connections are required, with the centre being a hollow space (much like an extension tube).
Similarly, one could make an adaptor for many other lens mounts, as 18mm is one of the shorter flange focal distances on the market. The most common mounts are listed here by flange focal distance, indicating what lenses might be able to be mounted on an EF-M camera (if a mount adaptor was created, with the appropriate spacing). Canon are almost certainly not going to make any other adaptors than the EF-M, but you might see some appear from 3rd-party lens manufacturers, or 'generics' from online auction sites.
Mounting an EF-M lens on another camera
Conversely, due to the short flange focal distance, an EF-M lens would require an adaptor with optics to correct for the longer flange focal distance in order to use it on most other mounts (e.g. an EF or EF-S camera) if you wanted to retain the full range of focus (especially infinity). An example of this is Canon's EF-FD adaptor that was available briefly after the introduction of the EF mount in 1987. Such adaptors usually only work with telephoto lenses, so neither of the current EF-M lenses are likely to be usable on EF/EF-S cameras (or indeed most other mounts), except perhaps as macro lenses (without the correcting optics in an adaptor).
The EF-M lenses are designed for the new mirrorless camera system, and mount much closer to the sensor than the EF-S lenses (which are designed for DSLRs with a mirror box).
You can use EF-S (and EF) lenses on the M system cameras using an adapter (which is just a spacer with some electrical connections to move the rear of the lens further from the sensor), but you cannot use EF-M lenses on Canon's APS-C-format DSLRs. (Unless someone makes an adapter with additional optical elements; the distance between the lens mount and the sensor would prevent anything even approaching infinity focus without additional lens elements.)