Lock the slide to the rear and lower the sear disconnect lever. Let the slide forward. If you want the sear disconnect lever back in place, insert a magazine.
But it's a waste of time. The gun will not fire accidentally and it does not hurt to dry fire. I have been a certified M&P armorer...