module Main where

import Control.Applicative
import Control.Monad
import Data.List

main :: IO ()
main = do
    n <- readLn
    a <- readLn
    if (n `mod` 500) <= a
        then putStrLn "Yes"
        else putStrLn "No"