public static int recursion(int n, int m, int step){
        if (n == m){
            return m + step - 1;
        }
        if (n%2 == 0 && (n/2 + step)%m == 0){
            return n/2 + step;
        }
        else {
            if (n<m)      {
                return -1;
            } else {
                return recursion(n-1, m, ++step);
            }
        }
    }