Assume for all nodes in M, the min distance and correct first hop from S have been found - consider node X in N-M having min dist from S among all nodes in N-M. Is there shorter path to X? NO, WHY?
Consider shorter path to X. If node before X is not in M, then it would have been chosen instead of X. So X is first node outside of M on this shorter path. But then dist to X would already be this shorter value ...