import sys

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



def resolve():

    def main():

        n=int(eval(input()))

        a=int(eval(input()))

        for i in range(21):

            for j in range(a+1):

                if 500*i+1*j==n:

                    return 'Yes'

        return 'No'

    print((main()))

resolve()
import sys

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



def resolve():

    n=int(eval(input()))

    a=int(eval(input()))

    if n%500>a:

        print('No')

    else:

        print('Yes')

resolve()
import sys


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


def resolve():
    def main():
        n = int(eval(input()))
        a = int(eval(input()))
        for i in range(21):
            for j in range(a + 1):
                if 500 * i + 1 * j == n:
                    return "Yes"
        return "No"

    print((main()))


resolve()

import sys


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


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


resolve()

-    def main(): -        n = int(eval(input())) -        a = int(eval(input())) -        for i in range(21): -            for j in range(a + 1): -                if 500 * i + 1 * j == n: -                    return "Yes" -        return "No" - -    print((main())) +    n = int(eval(input())) +    a = int(eval(input())) +    if n % 500 > a: +        print("No") +    else: +        print("Yes")