E869120 has A 1-yen coins and infinitely many 500-yen coins.   Determine if he can pay exactly N yen using only these coins.
N,A = map(int,open(0).read().split())
if 500+A >= N:
    print("Yes")
else:
    print("No")
    
N,A = map(int,open(0).read().split())
if N%500 <= A:
    print("Yes")
else:
    print("No")
