M.2 slots will accept about whatever you want to install in them. The M.2 specification is just a hardware spec.
It appears, however, that your mobo does not have the correct connectors in the I/O shield for WiFi antenna connections so you would need something similar to this to make it work:
https://www.newegg.com/fenvi-fv-ax200h-m-2/p/0XM-00JK-00063?Description=wireless antenna for desktop&cm_re=wireless_antenna for desktop--9SIADXZ9FP7904--Product
I'm not reccomending that specific brand. It's just an example of the hardware you need.
Here's a video also but it uses connectors in the I/O shield that you don't have:
https://www.google.com/search?client=firefox-b-1-d&q=m.2+wifi+card#kpvalbx=_gh2MX_iPMov-sAXHr7-ADA22
not true. you need to match the key. and M key device work in M slot but not B only slot.M.2 slots will accept about whatever you want to install in them. The M.2 specification is just a hardware spec.