^x2 - exactly correct. The M.2 is a physical connector, how it's connected electrically on the drive is what makes it fast. They have the following formats:
SATA based. Has a sata based controller on the drive. Uses SATA protocols and is limited to SATA speeds. (500-550MB/sec).
PCIe x2. Uses PCIe lanes for a maximum of about 1200-1400MB/sec and uses the NVME protocol (1.2-1.4GB/sec).
PCIe x4. Uses PCIe lanes for a max of about 3200MB-3400MB/sec and uses the NVME protocol (3.2-3.4GB/sec).
Note that this is how it is wired on the drive, not the motherboard. Most M.2 sockets on the motherboard will support both SATA and PCIe, and will autodetect the type on boot. You'd have to read the documentation to find out for sure.