public static long inverseModulo(long a, long m) {
        if (a <= 1 || m <= 1 || Num2.euclideEtendu(a, m)[0] != 1) throw new IllegalArgumentException();

        long x0 = Num2.euclideEtendu(a, m)[1];
        while (x0 < 0) {
            x0 += m;
        }
        return x0;
    }