That polynomial is made up of 2 terms,

and 7y, separated by a minus sign. To find the degree of a polynomial you consider the term with the highest degree, no matter that the variables are different. The degree on the first term is 5+2=7, whereas the degree on the second term is just 1. Since the degree of a polynomial is equal to the degree of the term that is highest, our degree is 7.