Returning value when computing modulo inverse

Why do we return (x+m)%m when computing inverse modulo using extended euclid ?

To handle the negative values of x. If x = -3 and m = 7, then instead of doing 7*(-1) + 4 = -3, we simply add m(i.e.7) to -3. So -3 + 7 = 4 and we take %m further if x is not negative.