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):
"""
author : halo2halo
date : 24,Oct,2019
"""

import sys
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 7)

N = int(readline().rstrip())
A = int(readline().rstrip())


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 = N % 500
if A < N:
  print("No")
else:
  print("Yes")

Solution (Python):
N = int(input())
A = int(input())
i = int(1)
K = int(0)
B = int (N%500)

while i <= A:
    if(B == i):
      K = i
      break
    else:
      i += 1

if(K!=B):
    print("No")
else:
    print("Yes")

Solution (Python):
n, a = map(int, open(0));print("YNeos"[n % 500-a > 0::2])

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



import unittest
from io import StringIO
import sys


def input():
    return sys.stdin.readline().rstrip()


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


class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)

    def test_入力例_1(self):
        input = """2018
218"""
        output = """Yes"""
        self.assertIO(input, output)

    def test_入力例_2(self):
        input = """2763
0"""
        output = """No"""
        self.assertIO(input, output)

    def test_入力例_3(self):
        input = """37
514"""
        output = """Yes"""
        self.assertIO(input, output)


if __name__ == "__main__":
    
    resolve()

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

mod = N % 500

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

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

while A >= 500:
  A = A - 500

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

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

sum = 0

while True:
  if sum > N:
    sum -= 500
    break
  sum += 500
  
for i in range(A):
  if sum < N:
  	sum += 1
if sum == 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 N % 500 <= A:
  print('Yes')
else:  
  print('No')

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

Solution (Python):
n, a = [int(input()) for _ in range(2)]
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:
    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())
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, a = [int(input()) for _ in range(2)]
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())
print("Yes" if a>=n%500 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())
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())
print("Yes") if (N % 500)<=A else print("No")

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

Solution (Python):
N,A = map(int,open(0).read().split())

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):
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))
def do():
    x=INT()
    a=INT()
    y=x%500
    if a>=y:
        print('Yes')
    else:
        print('No')
if __name__ == '__main__':
    do()

Solution (Python):

N, A = map(int, open(0).read().split())
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())
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())
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())
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())
t = n % 500
if t <= 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):
print('Yes'if int(input())%500<=int(input()) else'No')

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

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

Solution (Python):
a = [int(input()) for i in range(2)]
N = a[0]
A = a[1]
if N-(N//500)*500<=A:
    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())

print('Yes' if N % 500 <= A else '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())

n %= 500

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

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

for i in range(a+1):
    if (n-i)%500 == 0:
        b=True
        break
if 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 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):



def main():

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

    if n >= 500:
        if n%500-a <= 0:
            print('Yes')
        else:
            print('No')
    else:
        if n-a <= 0:
            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,a=int(input()),int(input())
if a+n//500*500>=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())

coin_500 = n//500
if n-500*coin_500 <= a:
    print('Yes')
else:
    print('No')

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

ans = A % 500

if ans <= N:
  print("Yes")
else:
  print("No")

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

rem = N%500

if rem <= 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 slove():
    import sys
    input = sys.stdin.readline
    n = int(input().rstrip('\n'))
    a = int(input().rstrip('\n'))
    n %= 500
    print("Yes" if n <= a else "No")


if __name__ == '__main__':
    slove()

Solution (Python):
import math

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

    m = math.floor(n/500)
    m = n - 500*m

    print('Yes' if m <= a else 'No')

aa088()

Solution (Python):
import sys

input = sys.stdin.readline


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


if __name__ == "__main__":
    main()

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

if n%500==0:
    print('Yes')
elif 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):
print('YNeos'[int(input())%500>int(input())::2])

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

r = N % 500

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

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

while X>=500:
  X=X-500

if X>A:
  print('No')
else:
  print('Yes')

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):
x=int(input())
y=int(input())
if x%500<=y:
  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:
    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 print("No")

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

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

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

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

Solution (Python):
s=list(map(int,input().split()))
t=list(map(int,input().split()))
a=int(s[0])
b=int(t[0])
c=a%500
if c<=b:
  print('Yes')
else:
  print('No')

Solution (Python):
N,A = map(int,open(0).read().split())
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 n%500<=a else "No")

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

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

while n >= 500:
    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())
x = n % 500
if x <= 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())
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())

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

Solution (Python):
n,a=[int(input()) for _ in range(2)]
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())
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())

print('Yes' if 500*(n//500) + a >= n else 'No')

Solution (Python):

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

for i in range(a+1):
    for j in range(21):
        if i + 500*j == n:
            print('Yes')
            exit()
print('No')

Solution (Python):


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

  b = n % 500

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


if __name__ == "__main__":
    resolve()

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):
N = int(input().strip())
A = int(input().strip())

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

Solution (Python):
n=int(input())
a=int(input())
print(("No","Yes")[n%500<=a])

Solution (Python):

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

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

Solution (Python):

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


if A>=500:
    print("Yes")



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

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

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

a = int(input())

surplus = n % 500

if surplus > 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):
def solve():
    N, A = [int(input()) for _ in range(2)]
    remainder = N % 500
    if remainder <= A:
        print("Yes")
    else:
        print("No")

solve()

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):
print(["Yes","No"][int(input())%500>int(input())])

Solution (Python):
import sys

if sys.platform =='ios':
    sys.stdin=open('input_file.txt')

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

nmod=N%500

if nmod<=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):
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())
r = "Yes" if n % 500 <= a else "No"
print(r)

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 (0 <= N%500) and (N%500 <= A):
    print("Yes")
else:
    print("No")

Solution (Python):

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


num_500 = int(N / 500)


nec_1 = N - (500 * num_500)


if nec_1 <= 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())%500
a=int(input())
if n<=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):
a=int(input())
b=int(input())
amari=a%500
if amari<=b:
  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())
x = N - (500*(N//500))
if x <= A:
  print('Yes')
else:
  print('No')

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

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

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

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())
for i in range(a):
    if n%500==0:
        break
    else:
        n-=1
print('Yes' if n%500==0 else'No')

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

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

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

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

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

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

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

Solution (Python):
import sys
import math
from fractions import gcd





def lcm(a, b):
    return a * b // gcd(a, b)

def combination_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

def permutations_count(n, r):
    return math.factorial(n) // math.factorial(n - r)

big_prime = 1000000007

"""


 =  sys.stdin.readline().rstrip()
 =  list(sys.stdin.readline().rstrip())


 =  int(sys.stdin.readline())
 =  map(int, sys.stdin.readline().split())
 =  list(map(int, sys.stdin.readline().split()))
 =  [list(map(int,list(sys.stdin.readline().split()))) for i in range(N)]
"""


N =  int(sys.stdin.readline())
A =  int(sys.stdin.readline())

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

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

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())
print('Yes' if n%500<=a else 'No')

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

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

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

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

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

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

if N>=500 and N-500*int(N/500)<=A:
    print('Yes')
elif N<500 and 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())
print('Yes' if n%500 <= a else 'No')

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

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())
print('Yes' if n % 500 <= a else '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())
mod=n%500
if mod<=a:
    print("Yes")
else:
    print("No")

Solution (Python):
n = int(input())
a = int(input())
if 1 <= n <= 10000 and 0 <= a <= 1000:
    if a >= 499:
        print('Yes')
    elif a >= n % 500:
        print('Yes')
    else:
        print('No')
else:
    print('hoge!')

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

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

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

remain = n % 500
judge = remain - a

if judge > 0:
  print("No")
else:
  print("Yes")

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

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

Solution (Python):
l=[int(input()) for i in range(2)]
N=l[0]
A=l[1]
r=N%500
if r > A:
	print('No')
else:
	print('Yes')

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

Solution (Python):
pay = int(input())
one = int(input())

if one >= pay%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())

flag = True
for a in range(A+1):
  if (N-a)%500 == 0:
    print('Yes')
    flag = False
    break
if flag:
  print('No')

Solution (Python):
n,a=map(int,open(0));print("YNeos"[n%500>a::2])

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

res = N%500

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

Solution (Python):


n = int(input())
a = int(input())
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("No")
else:
    print("Yes")

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

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

Solution (Python):
n, a = (int(input()) for _ in range(2))
print('No' if n%500 >a else 'Yes')

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

Solution (Python):
import sys
from statistics import *
from collections import *
from operator import itemgetter
stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline()

n = ni()
a = ni()
print('Yes' if n - (n // 500) * 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())
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())

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

Solution (Python):
n,a=map(int,open(0));print("YNeos"[n%500>a::2])

Solution (Python):
print("Yes") if int(input())%500 <= int(input()) 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):
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 = list(map(int , input().split()))
B = list(map(int , input().split()))
amari =  n[0]%500
if amari - B[0]  <= 0:
    print('Yes')
else:
    print('No')

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

W = N % 500

print("Yes") if A>=W else print("No")

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

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

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

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


if __name__ == "__main__":
    resolve()

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 == 0:
    print('Yes')
elif A >= N%500:
    print('Yes')
else:
    print('No')

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

Solution (Python):


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

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

Solution (Python):


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

left_N = N % 500
if N % 500 == 0:
  
  print("Yes")
elif left_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())

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

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

Solution (Python):
n, a = (int(input()) for _ in range(2))
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())

q = n % 500

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

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

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

Solution (Python):
N = int(input())
coinsize = int(input())
yes = False

if coinsize is 0:
    if(N % 500 is 0):
        print("Yes")
        yes = True
        
else:
    for i in range(coinsize):

        if((N - 1*i) % 500 is 0):
            print("Yes")
            yes = True
            break
    
if yes is False:
    print("No")

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

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

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

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

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

Solution (Python):
N, A = map(int, [input() for i in range(2)])
print("Yes") if N % 500 <= A 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()) % 500
if N > int(input()):
    print("No")
else:
    print("Yes")

Solution (Python):




import math
import statistics

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:
        return "Yes"
    return "No"
    
if __name__ == '__main__':
    print(main())

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 %= 500

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

Solution (Python):
pay = input()
oney = input()

print('Yes' if (int(pay) % 500) <= int(oney) 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())

n = n%500

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

Solution (Python):

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


need = n % 500

if a >= need:
    print("Yes")
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())
while(n>0):
    n-=500
if(n<0):
    n+=500
if(n<=a):
    print("Yes")
else:
    print("No")

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

Solution (Python):
if __name__ == '__main__':
    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, a = [int(input()) for _ in range(2)]
print('Yes' if n%500 <= a else 'No')