Have you tried a few magazines?
Sounds like an extractor problem to me (the extractor is the hook on the bolt, the ejector is the piece attached to the barrel which can be bent).
Try removing the extractor from the bolt and make sure its not jammed, gunked up or damaged; It should look like this;
Here's a video on how to remove it;
Volquartsen M&P 15-22 Exact Edge Extractor Install - YouTube
If that doesn't work and the gun is new then i'd return it to the dealer/get them to send it to S&W.