We present an algorithm for computing the greatest integer that is not a solution of the modular Diophantine inequality ax mod b ≤ x, with complexity similar to the complexity of the Euclid algorithm for computing the greatest common divisor of two integers.