If B is a constant, for what value(s) of x will the graph of the function f(x) = sin(sqrt(B-x^2)) have a maximum.

i know sin has a max when it equals 1 so i set sin(sqrt(B-x^2)) = 1 and therefore sqrt(B-x^2) = pi/2 + 2(pi)n where n is an integer. however my teacher seemed to have done the problem a different way. He did:

sin(sqrt(B-x^2 + 2(pi)r)) = 1 so therefore pi/2 = sqrt(B - x^2 + 2(pi)r). i don't understand why a 2(pi) r term was added under the radical as opposed to what i did which was add the 2(pi)n term after the pi/2. Was my way correct?