Problem:
 Score: 100 points    Problem Statement  E869120 has A  1 -yen coins and infinitely many 500 -yen coins. Determine if he can pay exactly N yen using only these coins.      Constraints   N is an integer between 1 and 10000 (inclusive).  A is an integer between 0 and 1000 (inclusive).         Input  Input is given from Standard Input in the following format:  N  A       Output  If E869120 can pay exactly N yen using only his 1 -yen and 500 -yen coins, print Yes ; otherwise, print No .        Sample Input 1 2018
218      Sample Output 1 Yes  We can pay 2018 yen with four 500 -yen coins and 18  1 -yen coins, so the answer is Yes .       Sample Input 2 2763
0      Sample Output 2 No  When we have no 1 -yen coins, we can only pay a multiple of 500 yen using only 500 -yen coins. Since 2763 is not a multiple of 500 , we cannot pay this amount.       Sample Input 3 37
514      Sample Output 3 Yes

Solution (Python):
N = int(input())
A = int(input())
amari = N % 500
if A >= amari:
    print("Yes")
else:
    print("No")

Solution (Python):
print('Yes' if (int(input()) % 500) <= int(input()) else 'No')

Solution (Python):
import sys
from math import sqrt
from collections import Counter

input = sys.stdin.readline


def I():
    return int(input())


def MI():
    return map(int, input().split())


def LI():
    return list(MI())


inf = float("inf")
mod = 10 ** 9 + 7


def main():
    n = I()
    a = I()

    if n % 500 <= a:
        print("Yes")
    else:
        print("No")

    pass


if __name__ == "__main__":
    main()

Solution (Python):
n=int(input())
a=int(input())
k = n%500
if k<=a:print('Yes')
else:print('No')

Solution (Python):
N = int(input())
A = int(input())
if (N % 500) <= A:
    print("Yes")
else:
    print("No")

Solution (Python):
N = int(input())
A = int(input())
if N % 500 <= A:
    print('Yes')
else:
    print('No')

Solution (Python):
N = int(input())
A = int(input())
if N%500<=A:
  print('Yes')
else:
  print('No')

Solution (Python):
N=int(input())
A=int(input())
print("Yes" if A>=N%500 else "No")

Solution (Python):
d=input;print('YNeos'[int(d())%500>int(d())::2])

Solution (Python):
N = int(input())
A = int(input())

M = N % 500
if M <= A:
    print("Yes")
else:
    print("No")

Solution (Python):
N = int(input())
A = int(input())

if A >= (N%500):
  print("Yes")
else:
  print("No")

Solution (Python):
n=int(input())
a=int(input())
print("Yes" if (n%500<=a) else "No")

Solution (Python):
n = int(input())
a = int(input())

m = n % 500
if m <= a:
    print('Yes')
else:
    print('No')

Solution (Python):
n = int(input())
a = int(input())

if n % 500 <= a:
    print("Yes")
else:
    print("No")

Solution (Python):
N=int(input())
A=int(input())
x=N%500
if A>=x:
  print("Yes")
else:
  print("No")

Solution (Python):
N = int(input())
A = int(input())
if N%500 <= A:
    print("Yes")
else:
    print("No")

Solution (Python):
n = int(input())
a = int(input())
if n%500 <=a:
  print('Yes')
else:
  print('No')

Solution (Python):
n = int(input())
a = int(input())
if n%500 <= a:
    print("Yes")
else:
    print("No")

Solution (Python):
n = int(input())
a = int(input())
print('No' if n%500>a else 'Yes')

Solution (Python):
n = int(input())
a = int(input())
if n % 500 <= a:
  print("Yes")
else:
  print("No")

Solution (Python):
n = int(input())
a = int(input())

if (n % 500 <= a):
    print("Yes")
else:
    print("No")

Solution (Python):
def main():
    n = int(input())
    a = int(input())

    mod = n % 500
    if mod <= a:
        ans = "Yes"
    else:
        ans = "No"
    print(ans)


if __name__ == "__main__":
    main()

Solution (Python):
n = int(input())
a = int(input())

mod = n % 500
if a >= mod:
  print('Yes')
else: print('No')

Solution (Python):
n=int(input())
a=int(input())
if n%500<=a:
    print("Yes")
else:
    print("No")

Solution (Python):
N=int(input())
A=int(input())
flag=True
ans="No"

for i in range(0,A+1):
  if flag:
    for j in range(0,N//500+1):
      if i+500*j==N:
        ans="Yes"
        flag=False
        break

print(ans)

Solution (Python):
n=int(input())
a=int(input())
n=n%500
if n-a<=0:
  print('Yes')
else:
  print('No')

Solution (Python):
N = int(input())
A = int(input())
amari = N % 500
if amari <= A:
    print("Yes")
else:
    print("No")

Solution (Python):
N=int(input())
A=int(input())

if N%500 <= A:
    print("Yes")
else:
    print("No")

Solution (Python):
n = int(input())
a = int(input())
print("Yes" if (n % 500) <= a else "No")

Solution (Python):

a = int(input())
b = int(input())
print('Yes' if a // 500 * 500 + b >= a else 'No')

Solution (Python):
n=int(input())
a=int(input())

amari=int(n%500)

if amari<=a:
    print('Yes')

else:
    print('No')

Solution (Python):


n = int(input())
a = int(input())

if n > a:
    if (n % 500) <= a:
        print("Yes")
    else:
        print("No")
else:
    print("Yes")

Solution (Python):
n = int(input())
a = int(input())

if n%500 <= a:
  print('Yes')
else:
  print('No')

Solution (Python):
N = int(input())
A = int(input())

if A >= N%500:
    print('Yes')
else:
    print('No')

Solution (Python):
import sys
import os


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    N, A = [int(sys.stdin.buffer.readline().rstrip()) for _ in range(2)]
    print('Yes' if N%500 <= A else 'No')


if __name__ == '__main__':
    main()

Solution (Python):
import sys

def main():
    N = int(input())
    A = int(input())
    x = N % 500
    if x<=A:
        print('Yes')
    else:
        print('No')

main()

Solution (Python):

money = int(input())
many_1_coin = int(input())
print("Yes" if (money % 500) <= many_1_coin else "No")

Solution (Python):
n = int(input())
a = int(input())

if (n % 500) <= a:
    print("Yes")
else:
    print("No")

Solution (Python):
x, a = [int(input()) for i in range(2)]
print("Yes" if a >= x%500 else "No" )

Solution (Python):
N,A = [int(input().rstrip()) for i in range(2)]
if N-int(N/500)*500 <= A:
    print("Yes")
else:
    print("No")

Solution (Python):
n = int(input())
a = int(input())

if n % 500 <= a:
    print("Yes")
else:
    print("No")

Solution (Python):
n=int(input())
a=int(input())

if n>=500:
    n=n%500

if n<=a:
    print("Yes")
else:
    print("No")

Solution (Python):
import sys

n = int(input())
a = int(input())

amari = n % 500

print("Yes") if amari <= a else print("No")

Solution (Python):
print("Yes" if int(input()) % 500 <= int(input()) else "No")

Solution (Python):
n=int(input())
a=int(input())
print('Yes' if n%500<=a else 'No')

Solution (Python):
N = int(input())
A = int(input())

a = N % 500
if a <= A:
    print('Yes')
else:
    print('No')

Solution (Python):
N = int(input())
A = int(input())
if N%500<=A:
  ans = 'Yes'
else:
  ans = 'No'
print(ans)

Solution (Python):
n = int(input())
a = int(input())

if (n%500) <= a:
    print('Yes')
else:
    print('No')

Solution (Python):
N = int(input())
A = int(input())
if N%500 <= A:
  print('Yes')
else:
  print('No')

Solution (Python):
cost = int(input())
itien = int(input())
if itien >= cost % 500:
  print("Yes")
else:
  print("No")

Solution (Python):
N=int(input())
A=int(input())
number=0
for a in range(A+1):
    b=N-a
    if b%500==0:
        print('Yes')
        number+=1
        break
if number==0:
    print('No')

Solution (Python):
n = int(input())
a = int(input())
c = n % 500
if c <= a:
    print('Yes')
else:
    print('No')

Solution (Python):

n=int(input())
a=int(input())
if (n%500)>a:
    print("No")
else:
    print("Yes")

Solution (Python):
N = int(input())
A = int(input())

rmn = N % 500

if rmn <= A:
    print("Yes")
else:
    print("No")

Solution (Python):
n = int(input())
a = int(input())
nd5 = n//500
f = False
if nd5*500+a >= n:
    f = True
print("Yes") if f else print("No")

Solution (Python):
N = int(input())
A = int(input())
if A >= N%500:
    print("Yes")
else:
    print("No")

Solution (Python):
n = int(input())
a = int(input())
if (n % 500) <= a:
  print('Yes')
else:
  print('No')

Solution (Python):
n = int(input())
a = int(input())
coin = n%500
if a >= coin:
  print("Yes")
else:
  print("No")

Solution (Python):
N = int(input())
A = int(input())

if N % 500 <= A:
    print('Yes')
else:
    print('No')

Solution (Python):
n = int(input())
a = int(input())

rest = n%500
if (a>=rest):
  print("Yes")
else:
  print("No")

Solution (Python):
n = int(input())
a = int(input())

n = n % 500

if a >= n:
    print('Yes')
else:
    print('No')

Solution (Python):
n = int(input())
a = int(input())
if n%500<=a:
  print('Yes')
else:
  print('No')

Solution (Python):
n = int(input())
a = int(input())
if n % 500 <= a:
    print("Yes")
else:
    print("No")

Solution (Python):
n = int(input())
a = int(input())

if n % 500 <= a:
    print("Yes")
else:
    print("No")

Solution (Python):

n=int(input())
a=int(input())
if (n%500)<=a:
    print("Yes")
else:
    print("No")

Solution (Python):
n = int(input())
a = int(input())
remainder = n % 500
if remainder <= a:
    print("Yes")
else:
    print("No")

Solution (Python):


"""
Created on Tue Mar 10 05:50:12 2020

@author: baddude
"""


ttl = int(input())
no_1yen = int(input())

remain = ttl % 500
if no_1yen >= remain:
    print('Yes')
else:
    print('No')

Solution (Python):
n=int(input())
a=int(input())

n=n%500

if a>=n:
  print("Yes")
else:
  print("No")

Solution (Python):
n = int(input())
a = int(input())

if n%500 <= a:
  print('Yes')
else:
  print('No')

Solution (Python):
N=int(input())
A=int(input())

if N%500<=A:
  print("Yes")
else:
  print("No")

Solution (Python):
N = int(input())
A = int(input())
if N%500 <=A :
	print("Yes")
else:
	print("No")

Solution (Python):
N = int(input())
A = int(input())
if N%500 <=A :
	print("Yes")
else:
	print("No")

Solution (Python):
N = int(input())
A = int(input())

if A >= N%500 :
  print('Yes')
  
else:
  print('No')

Solution (Python):
n,a=[int(input()) for i in range(2)]

print("Yes" if n%500<=a else "No")

Solution (Python):
import sys
n = int(sys.stdin.readline())
a = int(sys.stdin.readline())

if n % 500 <= a:
    print("Yes")
else:
    print("No")

Solution (Python):


N = int(input())

A = int(input())

mod = N % 500

if mod <= A:
  print('Yes')
else:
  print('No')

Solution (Python):
n = int(input())

n_rem = n % 500

a = int(input())

if a >= n_rem:
    print("Yes")
    
else:
    print("No")

Solution (Python):
from sys import stdin

n = int(stdin.readline().rstrip())
a = int(stdin.readline().rstrip())

if n%500 - a <= 0:
    print("Yes")
else:
    print("No")

Solution (Python):
n=int(input())
a=int(input())
if n%500<=a:
  print("Yes")
else:
  print("No")

Solution (Python):
a,b=[int(input()) for _ in range(2)]
print("Yes" if (a%500 < b) or (a%500==0) else "No")

Solution (Python):



def main():
    n = int(input())
    a = int(input())
    
    

    check = n % 500
    

    if check <= a:
        print('Yes')
    else:
        print('No')


main()

Solution (Python):
n = int(input())
a = int(input())


print("Yes" if n % 500 <= a else "No")

Solution (Python):
N=int(input())
A=int(input())
if N%500 <=A:
    print('Yes')
else:
    print('No')

Solution (Python):

def Infinite_Coins(n , a):

    return "Yes" if (n % 500) <= a else "No"

def main():
    n = int(input())
    a = int(input())
    print(Infinite_Coins(n , a))

if __name__ == '__main__':
    main()

Solution (Python):
n = int(input())
a = int(input())
x = n % 500
if a == 0 and x != 0:
    print("No")
elif x <= a:
    print("Yes")
else:
    print("No")

Solution (Python):
n = int(input())
a = int(input())
print('Yes' if ((n%500)-a)<=0 else 'No')

Solution (Python):
N = int(input())
A = int(input())

if N % 500 <= A:
    print("Yes")
else:
    print("No")

Solution (Python):
N=int(input())
A=int(input())

if N%500 <= A:
  print("Yes")
elif N%500 > A:
  print("No")

Solution (Python):
n = int(input())
a = int(input())

if n % 500 <= a:
  print("Yes")
else:
  print("No")

Solution (Python):
n = int(input())
a = int(input())
print("Yes" if n%500<=a else "No")

Solution (Python):
n = int(input())
a = int(input())
if n%500 > a:
    print('No')
else:
    print('Yes')

Solution (Python):
n = int(input())
a = int(input())
for i in range(a+1):
  if (n-i) % 500 == 0:
    print('Yes')
    break
else:
  print('No')

Solution (Python):
N = int(input())
A = int(input())
B = N % 500
if A >= B:
    print("Yes")
else:
    print("No")

Solution (Python):
n = int(input())
a = int(input())

print('Yes' if n % 500 <= a else 'No')

Solution (Python):
N, A = [int(input()) for _ in range(2)]

if N % 500 <= A:
  print('Yes')
else:
  print('No')

Solution (Python):
n = int(input())
a = int(input())

if a - (n % 500) >= 0:
    print("Yes")
else:
    print("No")

Solution (Python):
n = int(input())
a = int(input())
if (n%500) <= a:
    print("Yes")
else:
    print("No")

Solution (Python):
N = int(input())
A = int(input())

if N % 500 <= A:
    print('Yes')
else:
    print('No')

Solution (Python):
N = int(input())
A = int(input())

total = 0
while True:
    total += 500
    if total > N:
        if total - 500 + A >= N:
            print('Yes')
        else:
            print('No')
        break
    elif total == N:
        print('Yes')
        break

Solution (Python):
N = int(input())
A = int(input())
print('Yes' if N % 500 <= A else 'No')

Solution (Python):

n = int(input())
a = int(input())

if (n % 500) <= a:
	print('Yes')
else:
    print('No')

Solution (Python):


N = int(input())
a = int(input())

if N % 500 <= a:
    print('Yes')
else:
    print('No')

Solution (Python):

n=int(input())
a=int(input())
print('Yes' if n%500<=a else 'No')

Solution (Python):
N = int(input())
A = int(input())
if N % 500 > A:
  print("No")
else:
  print("Yes")

Solution (Python):
a = int(input())
b = int(input())
if a % 500 <= b:
  print("Yes")
else:
  print("No")

Solution (Python):
N = int(input())
A = int(input())
if N%500 <= A:
    print("Yes")
else:
    print("No")

Solution (Python):
n = int(input())
a = int(input())

x = (n // 500) * 500
if n // 500 >= 1:
    if n - x <= a:
        print("Yes")
        exit()
    else:
        print("No")
        exit()
elif n <= a:
    print("Yes")
    exit()


print("No")

Solution (Python):
n=int(input())
a=int(input())
print("Yes") if n%500<=a else print("No")

Solution (Python):
n = int(input())
a = int(input())
cost = n % 500
if cost <= a:
    print('Yes')
else:
    print('No')

Solution (Python):
n = int(input())
a = int(input())

print("Yes" if a - n%500 >= 0 else "No")

Solution (Python):
n = int(input())
a = int(input())

q, r = divmod(n, 500)
if r <= a:
    print('Yes')
else:
    print('No')

Solution (Python):
n = int(input())
a=int(input())
print("Yes" if n%500<=a else "No")

Solution (Python):
n = int(input())
a = int(input())
if n%500<=a:
    print("Yes")
else:
    print("No")

Solution (Python):
n = int(input())
a = int(input())
n %= 500
if n <= a:
    print('Yes')
else:
    print('No')

Solution (Python):
n=int(input())
a=int(input())
if n%500<=a:
    print("Yes")
else:
    print("No")

Solution (Python):
N = int(input())
A = int(input())

if (N%500) <= A:
    print('Yes')
else:
    print('No')

Solution (Python):
n = int(input())
a = int(input())
if n%500 <= a:
    print("Yes")
else:
    print("No")

Solution (Python):
N=int(input())
A=int(input())
val=N%500
if val<=A:
    print('Yes')
else:
    print('No')

Solution (Python):
N = int(input())
A = int(input())

num = N % 500

if num <= A:
  print("Yes")
else:
  print("No")

Solution (Python):
N = int(input())
A = int(input())

if N % 500 > A:
    print('No')
else :
    print('Yes')

Solution (Python):
n = int(input())
a = int(input())
print('Yes' if n % 500 <= a else 'No')

Solution (Python):
n = int(input())
a = int(input())

print("Yes" if n % 500 <= a else "No")

Solution (Python):
n = int(input())
a = int(input())

m = n % 500
if m <= a:
    print('Yes')
else:
    print('No')

Solution (Python):
N = int(input())
A = int(input())

N %= 500
if N <= A:
  print('Yes')
else:
  print('No')

Solution (Python):
N=int(input())
A=int(input())
print("Yes" if N%500<=A else "No")

Solution (Python):
n=int(input())
a=int(input())
print('YNeos'[n%500>a::2])

Solution (Python):
N = input()
A = input()
N = int(N)
A = int(A)

if (N % 500 <= A):
	print("Yes")
else:
	print("No")

Solution (Python):
N = int(input())
A = int(input())
N = N % 500

if N <= A:
  print('Yes')
else:
  print('No')

Solution (Python):
n = int(input())
a = int(input())

print("Yes" if a >= n - 500*(n//500) else "No")

Solution (Python):
if int(input())%500<=int(input()):
  print("Yes")
else:
  print("No")

Solution (Python):
n=int(input())
a=int(input())
if n%500<=a:
    print("Yes")
else:
    print("No")

Solution (Python):
N = int(input())
A = int(input())
print('Yes' if (N % 500) <= A else 'No')

Solution (Python):
N = int(input())
A = int(input())
if(N%500 <= A):
    print('Yes')
else:
    print('No')

Solution (Python):
















n = int(input())
a = int(input())

if n % 500 <= a:
    print('Yes')
else:
    print('No')

Solution (Python):
def main():
    N = int(input())
    A = int(input())
    if N % 500 <= A :
        print("Yes")
    else:
        print("No")


if __name__ == "__main__":
    main()

Solution (Python):
print("Yes" if int(input())%500<=int(input()) else "No")

Solution (Python):
n = int(input())
a = int(input())

if (n % 500) <= a:
  print('Yes')
else:
  print('No')

Solution (Python):
N =int(input())
A =int(input())
a = N%500
if a<=A:
  print("Yes")
else:
  print("No")

Solution (Python):
N=int(input())
A=int(input())
if N%500<=A:
    print("Yes")
else:
    print("No")

Solution (Python):
N = int(input())
A = int(input())

remain = N % 500

if remain <= A:
  print('Yes')
else:
  print('No')

Solution (Python):
n = int(input())
a = int(input())

if n % 500 <= a:
    print('Yes')
else:
    print('No')

Solution (Python):
n = int(input())
a = int(input())
if a >= n % 500:
  print('Yes')
else:
  print('No')

Solution (Python):
n=int(input())
a=int(input())

nn=n%500
if nn<=a:
  print("Yes")
else:
  print("No")

Solution (Python):
X = int(input())
A = int(input())

ans = "No"

tmp = X%500

if tmp <= A:
  ans = "Yes"

print(ans)

Solution (Python):
a = int(input())
b = int(input())
x = a%500
if x <= b:
  print("Yes")
else:
  print("No")

Solution (Python):
n = int(input())
a = int(input())
if n % 500 > a:
    print("No")
else:
    print("Yes")

Solution (Python):
n = int(input())
a = int(input())
print('Yes') if n%500 <= a else print('No')

Solution (Python):


N = int(input().strip())
A = int(input().strip())


count_500 = N // 500
N_remain = N % 500

count_1 = N_remain

if count_1 <= A and count_1 <= 1000:
    print("Yes")
else:
    print("No")

Solution (Python):
n = int(input())
a = int(input())

mod=n%500
if mod<=a:
    print("Yes")
else:
    print("No")

Solution (Python):
n = int(input())
a = int(input())
if n % 500 <= a:
    print("Yes")
else:
    print("No")

Solution (Python):
N=int(input())
A=int(input())
C=N%500
if C <= A:
  print('Yes')
else:
  print('No')

Solution (Python):
def main():
    cost = int(input())
    one_yen = int(input())
    if (cost - cost // 500 * 500) <= one_yen:
        print("Yes")
    else:
        print("No")


if __name__ == '__main__':
    main()

Solution (Python):
N = input()
A = input()
n = int(N)
a = int(A)


x = n % 500

if x <= a:
	print("Yes")
else:
	print("No")

Solution (Python):
N = int(input())
A = int(input())

if N%500 <= A:
  print("Yes")
else:
  print("No")

Solution (Python):
n,m=open(0)
n,m=int(n)%500,int(m)
print( "Yes" if n%500<=m else "No")

Solution (Python):
n = int(input())
a = int(input())
if n % 500 <= a:
    print("Yes")
else:
    print("No")

Solution (Python):
n=int(input())
a=int(input())
if n%500<=a:
  print("Yes")
else:
  print("No")

Solution (Python):
N=int(input())
A=int(input())
B=N%500
if A>=B:
	print("Yes")
else:
	print("No")

Solution (Python):
N = int(input())
A = int(input())
if N % 500 <= A:
    print('Yes')
else:
    print('No')

Solution (Python):
n = int(input())
a = int(input())

if a >= n % 500:
    print('Yes')
else:
    print('No')

Solution (Python):
n = int(input())
a = int(input())
if n % 500 <= a:
    print("Yes")
else:
    print("No")

Solution (Python):
n = int(input())
a = int(input())
 
if (n % 500) <= a:
  print("Yes")
else:
  print("No")

Solution (Python):
N = int(input())
A = int(input())

num = N%500
if num>A:
    print('No')
else:
    print('Yes')

Solution (Python):
N = int(input())
A = int(input())
d = N % 500
if d <= A:
  print('Yes')
else:
  print('No')

Solution (Python):
N = int(input())
A = int(input())

if N%500 > A:
    print("No")
else:
    print("Yes")

Solution (Python):
N = int(input())
A = int(input())
N_last = N % 500
if N_last <= A :
    print("Yes")
else :
    print("No")

Solution (Python):
N = int(input())
A = int(input())

print("Yes" if N % 500 <= A else "No")

Solution (Python):
n = int(input())
a = int(input())

n %= 500
if n <= a:
    print('Yes')
else:
    print('No')

Solution (Python):
def main():
    n=int(input())
    a=int(input())
    print('Yes' if n%500<=a else 'No')

main()

Solution (Python):
N=int(input())
A=int(input())
print('Yes' if N%500<=A else 'No')

Solution (Python):
n = int(input())
a = int(input())
n = n - (n//500)*500
if n<=a: print('Yes')
else: print('No')

Solution (Python):
n = int(input())
a = int(input())
if n % 500 <= a:
    print("Yes")
else:
    print("No")

Solution (Python):
print(["Yes","No"][int(input())%500 > int(input())])

Solution (Python):
n = int(input())
a = int(input())
print('Yes' if n%500 <= a else 'No')

Solution (Python):
x = int(input())
a = int(input())

s = x % 500
if a >= s:
    print("Yes")
else:
    print("No")

Solution (Python):
print('No')if int(input())%500>int(input())else print('Yes')

Solution (Python):
N = int(input())
A = int(input())
if N % 500 <= A:
  print("Yes")
else:
  print("No")

Solution (Python):
N = int(input())
A = int(input())
m = N % 500
if m <= A:
    print("Yes")
else :
    print("No")

Solution (Python):
N = int(input())
A = int(input())

if N%500 <= A:
  print("Yes")
else:
  print("No")

Solution (Python):

N = int(input())
A = int(input())


if N%500 <= A :
    print("Yes")
else :
    print("No")

Solution (Python):
n=int(input())
a=int(input())
if a>=n%500:print("Yes")
else:print("No")

Solution (Python):
n = int(input())
a = int(input())
n %= 500
if n <= a:
  print('Yes')
else:
  print('No')

Solution (Python):
try:
    N = int(input())
    A = int(input())

    if N%500!=0:
        mod = N%500
        print('Yes' if A>mod else 'No')
    else:
        print('Yes')
except EOFError:
    pass

Solution (Python):
N = int(input())
A = int(input())

n , _ = divmod(N, 500) 

remain = N-500*n

if remain <= A:
    print("Yes")
else:
    print("No")

Solution (Python):
N = int(input())
A = int(input())
p = N // 500
if p*500 + A >= N:
    print("Yes")
else:
    print("No")

Solution (Python):
N = int(input())
A = int(input())
print("Yes" if N % 500 <= A else "No")

Solution (Python):
n=int(input())
a=int(input())
if n%500 <=a:
    print('Yes')
else:
    print('No')

Solution (Python):
N = int(input())
A = int(input())

if N % 500 <= A:
    print('Yes')
else:
    print('No')

Solution (Python):
A=int(input())
N=int(input())

if N>=A%500:
  print("Yes")
else:
  print("No")

Solution (Python):
n = int(input())
a = int(input())

if n % 500 <= a:
  print("Yes")
else:
  print("No")

Solution (Python):
N=int(input())
A=int(input())
Q=N%500
if Q<=A:
    print("Yes")
else :
    print("No")

Solution (Python):
print('YNeos'[int(input())%500>int(input())::2])

Solution (Python):
N = int(input())
A = int(input())

if N % 500 <= A:
  print("Yes")
else:
  print("No")

Solution (Python):


n = int(input())
a = int(input())


if n < 500:
    if n <= a:
        print('Yes')
    else:
        print('No')
else:    
    amari = n%500
    if amari <= a:
        print('Yes')
    else:
        print('No')

Solution (Python):


n = int(input())
a = int(input())


if n < 500:
    if n <= a:
        print('Yes')
    else:
        print('No')
else:    
    amari = n%500
    if amari <= a:
        print('Yes')
    else:
        print('No')

Solution (Python):


n = int(input())
a = int(input())

if n > (500 * (n // 500)) + a:
    print("No")
else:
    print("Yes")

Solution (Python):
n=int(input())
print('Yes' if n%500 <= int(input()) else 'No')

Solution (Python):
n = int(input())
a = int(input())
temp  = n % 500
if temp <= a:
  print("Yes")
else:
  print("No")

Solution (Python):
N=int(input())
A=int(input())

if (N%500) <=A:
    print('Yes')
else:
    print('No')

Solution (Python):
N=int(input())
A=int(input())
p=N%500
print("Yes" if p<=A else "No")

Solution (Python):
N = int(input())
A = int(input())

if (N%500) <= A:
    print("Yes")
else:
    print("No")

Solution (Python):
N = int(input())
A = int(input())
if N % 500 > A:
  print('No')
else:
  print('Yes')

Solution (Python):
N = int(input())
A = int(input())
if N%500 > A:
  print('No')
else:
  print('Yes')

Solution (Python):
n = int(input())
a = int(input())

b = n % 500

if a >= b:
  print("Yes")
else:
  print("No")

Solution (Python):
N = int(input())
A = int(input())
modN = N % 500
if modN <= A:
    print("Yes")
else:
    print("No")

Solution (Python):
n = int(input())
a = int(input())
if n % 500 <= a: print("Yes")
else: print("No")

Solution (Python):
N = int(input())
A = int(input())
n = N % 500
if n<=A:
    print("Yes")
else:
    print("No")

Solution (Python):




def main():
    N = int(input())
    A = int(input())
    print('Yes'if N % 500 <= A else'No')


if __name__ == "__main__":
    main()

Solution (Python):
N = int(input())
A = int(input())

n = N % 500

if A >= n:
    print('Yes')
else:
    print('No')

Solution (Python):
en = int(input())
ichien = int(input())
dst = "Yes" if en % 500 <= ichien else "No"
print(dst)

Solution (Python):
a = int(input())
b = int(input())
if a%500 <= b:
  print("Yes")
else:
  print("No")

Solution (Python):
n = int(input())
a = int(input())

if n % 500 <= a:
    print("Yes")
else:
    print("No")

Solution (Python):
N = int(input())
A = int(input())

if 0 <= N % 500 <= A:
    print('Yes')
else:
    print('No')

Solution (Python):
n=int(input())  
a=int(input())  
if n % 500 <= a:
    print("Yes")
else:
    print("No")

Solution (Python):
n = int(input())
a = int(input())
N = n%500
print('Yes' if N<=a else 'No')

Solution (Python):
N = int(input())
A = int(input())
if N % 500 <= A:
  print('Yes')
else:
  print('No')

Solution (Python):
N = int(input())
A = int(input())
if N%500 <= A:
    print("Yes")
else:
    print("No")

Solution (Python):
a=int(input())
b=int(input())
print("Yes" if a%500 - b <= 0 else "No")

Solution (Python):
N=int(input())
A=int(input())

if (N%500<=A):
    print("Yes")
else:
    print("No")

Solution (Python):

n=int(input())
a=int(input())
if n%500<=a:
    print('Yes')
else:
    print('No')

Solution (Python):
N = int(input())
A = int(input())
if N % 500 <= A:
    print("Yes")
else:
    print("No")

Solution (Python):
n = int(input())
a = int(input())
b = n-500*int(n/500)
if a>=b:
  print("Yes")
else:
  print("No")

Solution (Python):
n = int(input())
a = int(input())

if n % 500 <= a:
  print('Yes')
else:
  print('No')

Solution (Python):
n=int(input())
a=int(input())
x=n%500
if x>a:
    print('No')
else:
    print('Yes')

Solution (Python):
n=int(input())
a = int(input())
if a >= n%500:
  print('Yes')
else:
  print('No')

Solution (Python):
n=int(input())
a=int(input())
n%=500
if n > a:
  print("No")
else:
  print("Yes")

Solution (Python):
"""
author : halo2halo
date : 24, Jan, 2020
"""

import sys
import itertools



read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N, A = map(int, read().split())

print('Yes' if N % 500 <= A else 'No')

Solution (Python):
print('Yes' if int(input())%500 <= int(input()) else 'No')

Solution (Python):
n=int(input())
a=int(input())
if n%500<=a:
    print('Yes')
else:
    print('No')

Solution (Python):
n = int(input())
a = int(input())
if n % 500 <= a:
    print("Yes")
else:
    print("No")

Solution (Python):
n = int(input())
a = int(input())
q, r = divmod(n, 500)
print('Yes') if a >= r else print('No')

Solution (Python):
n=int(input())
a=int(input())
x=n%500
print('Yes' if x<=a else 'No')

Solution (Python):
N = int(input())
A = int(input())
if A >= N%500:
    print('Yes')
else:
    print('No')

Solution (Python):
n = int(input())
a = int(input())

n = n % 500
if n <= a:
    print('Yes')
else:
    print('No')

Solution (Python):
N, A = (int(input()) for i in range(2))
print("Yes" if N%500<=A else "No")

Solution (Python):
N = int(input())
A = int(input())
r = N%500
if A >= r:
    print("Yes")
else:
    print("No")

Solution (Python):
n = int(input())
a = int(input())
v = n - (500 * (n // 500))

if n % 500 == 0 or a > n:
	print("Yes")
elif a >= v:
	print("Yes")
else:
	print("No")

Solution (Python):
n = int(input())
a = int(input())
if n % 500 <= a:
    print("Yes")
else:
    print("No")

Solution (Python):
n = int(input())
a = int(input())

while n >= 500:
    n -= 500
    
if n <= a:
    print('Yes')
else:
    print('No')

Solution (Python):
n = int(input())
a = int(input())
if n < 500:
    if a >= n:
        print("Yes")
    else:
        print("No")
else:
    remainder = n % 500
    if a >= remainder:
        print("Yes")
    else:
        print("No")

Solution (Python):
N = int(input())
A = int(input())

def main():
    for i in range(0, A+1):
        if (N - i) % 500 == 0:
            print('Yes')
            return
    print('No')

if __name__ == "__main__":
    main()

Solution (Python):
N = int(input())
A = int(input())
print("Yes" if N % 500 <= A else "No")

Solution (Python):
n = int(input())
a = int(input())
j = n % 500
if (j <= a):
  print("Yes")
else:
  print("No")

Solution (Python):
N = int(input())
A = int(input())

if N % 500 <= A:
    print('Yes')
else:
    print('No')

Solution (Python):
N = int(input())
A = int(input())

N = N%500

if N > A:
  print("No")
else:
  print("Yes")

Solution (Python):
N = int(input())
A = int(input())
Ns = N % 500
if Ns <= A:
    print("Yes")
else:
    print("No")

Solution (Python):


N = int(input())
A = int(input())

r = N % 500

ans = "Yes" if r <= A else "No"

print(ans)

Solution (Python):
N = int(input())
A = int(input())
if N % 500 <= A:
  print("Yes")
else:
  print("No")

Solution (Python):
N=int(input())
A=int(input())

if N%500<=A:
    print('Yes')
else:
    print('No')

Solution (Python):
N = int(input())
A = int(input())

r = N % 500

if r <= A:
    print("Yes")
else:
    print("No")

Solution (Python):
N=int(input())
A=int(input())
count=0
for i in range(0, A+1):
    if (N-i)%500 == 0:
        count=1
        break
print("Yes" if count==1 else "No")

Solution (Python):
n = int(input())
a = int(input())

if n %500 > a:
  print('No')
else:
  print('Yes')

Solution (Python):
n = int(input())%500
a = int(input())
if n <= a:
  print("Yes")
else:
  print("No")

Solution (Python):
N = int(input())
A = int(input())
print("YNeos"[not N%500<=A::2])

Solution (Python):
a,b = (int(input()) for _ in range(2))
print("Yes" if a%500<=b else "No")

Solution (Python):
N = int(input())
A = int(input())
for a in range(A+1):
    if (N-a)%500 == 0:
        print("Yes")
        exit()
print("No")

Solution (Python):
N = int(input())
A = int(input())

a = 0
for i in range(20):
  if N >= 500*(i+1):
    a =  500*(i+1)
  else:
    continue
    
b = N - a

if b <= A:
  print("Yes")
else:
  print("No")

Solution (Python):
n = int(input())
a = int(input())

if (n % 500) <= a:
  print("Yes")
else:
  print("No")

Solution (Python):


import numpy as np

n=int(input())
a=int(input())
n%=500
if(n<=a):print("Yes")
else:print("No")

Solution (Python):
n=int(input())
a=int(input())
if n % 500 > a:
  print("No")
else:
  print("Yes")