N, K = map(int, input().split()) assert K != 1