#!/usr/bin/env python3

import sys, math, itertools, heapq, collections, bisect

input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')

sys.setrecursionlimit(10**8)

inf = float('inf')

ans = count = 0



n=int(eval(input()))

n%=500

a=int(eval(input()))

if a>=n:

    print("Yes")

else:

    print("No")
#!/usr/bin/env python3

import sys, math, itertools, heapq, collections, bisect, string

input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')

sys.setrecursionlimit(10**7)

inf = float('inf')

mod = 10**9+7

ans = inf ;count = 0 ;pro = 1



n=int(eval(input()))

a=int(eval(input()))

n%=500

if n<=a:

    print("Yes")

else:

    print("No")
#!/usr/bin/env python3
import sys, math, itertools, heapq, collections, bisect

input = lambda: sys.stdin.buffer.readline().rstrip().decode("utf-8")
sys.setrecursionlimit(10**8)
inf = float("inf")
ans = count = 0
n = int(eval(input()))
n %= 500
a = int(eval(input()))
if a >= n:
    print("Yes")
else:
    print("No")

#!/usr/bin/env python3
import sys, math, itertools, heapq, collections, bisect, string

input = lambda: sys.stdin.buffer.readline().rstrip().decode("utf-8")
sys.setrecursionlimit(10**7)
inf = float("inf")
mod = 10**9 + 7
ans = inf
count = 0
pro = 1
n = int(eval(input()))
a = int(eval(input()))
n %= 500
if n <= a:
    print("Yes")
else:
    print("No")

-import sys, math, itertools, heapq, collections, bisect +import sys, math, itertools, heapq, collections, bisect, string -sys.setrecursionlimit(10**8) +sys.setrecursionlimit(10**7) -ans = count = 0 +mod = 10**9 + 7 +ans = inf +count = 0 +pro = 1 +a = int(eval(input())) -a = int(eval(input())) -if a >= n: +if n <= a: