N,K = map(int,input().split()) if (N-1)%(K+1)==0: print(0) else: print(1000)