n,k = list(map(int, input().split(' '))) if n%k > 0: print(-1) else: def f(m): if m