Actually Welcome to the Concept of the Angles.
Applying, angle sum Property of a triangle and linear pair, we get as,
180°-107 = 73°
, now angle sum property,
=> 31+73+p = 180
=> p = 180-104
=> p = 76°
here, angle p = angle x, they are vertically opposite angles, hence,
x = 76°
hence