М-да is a variant of да (as a particle) to express bewilderment, surprise, scepsis, and all kinds of ambiguous emotions. It's not that easy to describe the scope of its usage. The first element (м-) is the most expressive part, because you don't usually pronounce it but pull it out of your closed mouth. Actually you begin to sound [д] drawling it long before your mouth is open for [a]. Thus a semi-sound appears in front of the word.

Remember its written form: м-да. It's hyphenated. Many native speakers must keep that in mind also...