NK = [] for i in range(1000): n, k = map(int, input().split()) NK.append(n, k) n, k = NK[0] if (n-1)%(k+1) == 0: ans = 500 else: ans = 500 print(ans)