do you know how Euclidean algorithm works? it's a general way to find the gcd of 2 polynomials. in your example you just need to remember that you're doing everything modulo 5.

so let and use long division to get: here you can replace by if you like,

because 2 and -3 are equal modulo 5. next we use long division to divide by the remainder here is 0. so we're done and the gcd is