Can I reuse part of a paper for my thesis?
Yes. It is certainly okay. Indeed, general practice when writing a PhD thesis is to produce a number of publications that add up to the thesis, whether directly (using staples) or by a good deal of massage. Some published material may be omitted and some additional material may be included. There's no reason why this shouldn't apply to a Master's thesis, too.

It is a good idea to cite the paper in the thesis (if the paper has been accepted for publication) and the thesis in the paper, if possible.