I think this question is incorrect as:
let $ax+by = p, then, (a,b)|p, (a,y)|p, (x,b)|p, (x,y)|p$
now : $(a,b) = (a,y) = (x,b) = 1$
now let $p = m(x,y)$
so left to prove $(ax + by, ab) = 1$
which is the same as: $(m(x,y),ab) = 1$
but $m$ might be equal to any factor or multiple of $ab$
so I don't understand how is this true
(I'm sorry if my question tag is wrong as I couldn't figure out what to tag it with.)