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())
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 main():
    N = int(input())
    A = int(input())
    N -= int(N / 500) * 500
    print('Yes' if N <= A else 'No')


if __name__ == '__main__':
    main()

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

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

Solution (Python):

import numpy as np


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

hasu=N%500

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

Solution (Python):

"""
https://abc088.contest.atcoder.jp/tasks/abc088_a

"""
import sys
from sys import stdin
input = stdin.readline


def solve(N, A):
    N %= 500
    if 0 <= N <= A:
        return 'Yes'
    else:
        return 'No'


def main(args):
    N = int(input())
    A = int(input())
    ans = solve(N, A)
    print(ans)


if __name__ == '__main__':
    main(sys.argv[1:])

Solution (Python):
import random
import numpy
import sys

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

while N>=500:
  N-=500
if N>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())

for i in range(A+1):
    tmp=N-i
    if tmp%500==0:
        print("Yes")
        exit()

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):
    ans = "Yes"
else:
    ans = "No"
print(ans)

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

a, b = divmod(N, 500)
if N - 500 * a <= 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())
print("Yes" if N % 500 <= A else "No")

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

N = N % 500

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

Solution (Python):

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

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

b = N%500
a = 'Yes'
if(b > A):
    a = 'No'

print(a)

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())

r = n % 500

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

Solution (Python):



def document_it(func):
    def new_function(*args,**kwargs):
        print('Running function:', func.__name__)
        print('Positional arguments:', args)
        print('Kewword arguments:', kwargs)
        result = func(*args,**kwargs)
        print('Result:', result)
        return result
    return new_function


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

if __name__ == '__main__':
    exe()

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())

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

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

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

    m = N % 500
    if m == 0:
        print("Yes")
        return

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


if __name__ == '__main__':
    main()

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):
import math
import numpy as np
from operator import mul



















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

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

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

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

main()

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())

r = N % 500
if r <= 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):
def main():
    n = int(input())
    a = int(input())
    if n % 500 <= a:
        print('Yes')
    else:
        print("No")


if __name__ == '__main__':
    main()

Solution (Python):



n = int(input().strip())
a = int(input().strip())
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):
def i1():
 return int(input())
def i2():
 return [int(i) for i in input().split()]
n=i1()
a=i1()
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 (n%500)<=a else 'No')

Solution (Python):
N = int(input())
A = int(input())
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=int(input())
a=int(input())

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

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

n2=n%500

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

Solution (Python):
n=int(input())
a=int(input())
print(['No','Yes'][a-(n%500)>=0])

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

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

tmp = n % 500

if tmp <= 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 N%500 > A:
  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())
q = n % 500
if a >= q:
    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):
n = int(input())
a = int(input())
if n % 500 <= a:
  print("Yes")
else:
  print("No")

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

ans = N % 500
if ans <= 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, A = map(int, open(0).read().split())
print("Yes"*((N % 500) <= A)or"No")

Solution (Python):
n = input()
a = 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())
a = a % 500
if a > b:
 print("No")
else:
 print("Yes")

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

Solution (Python):
import sys
import math
import collections
import itertools
import array
import inspect


sys.setrecursionlimit(10000)


def chkprint(*args):
    names = {id(v):k for k,v in inspect.currentframe().f_back.f_locals.items()}
    print(', '.join(names.get(id(arg),'???')+' = '+repr(arg) for arg in args))


def to_bin(x):
    return bin(x)[2:]


def dim2input(N):
    li = []
    for _ in range(N):
        li.append(list(map(int, input())))
    return li

""" input template
S = input()
N = int(input())
L = list(map(int, input().split()))
a, b = list(map(int, input().split()))
SL = list(input())
"""



dp = None

def main():
    N = int(input())
    A = int(input())

    N %= 500

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

main()

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 = input()
A = input()
while N >= 500:
    N -= 500
print "Yes" if A >= N 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())
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')