From the problem, we have a triangle and we need to find the measurements of the angles marked in blue.
Note that angles adjacent to each other in a straight line have a sum of 180 degrees.
That will be :

The other angle is :

Now we have the two angles in a triangle, 40 and 90 degrees, and the sum of interior angles in a triangle is always 180 degrees.
That will be :

ANSWER :
p = 50 degrees