import qualified Data.ByteString.Char8 as C
import Data.Maybe ( fromJust )

readInt :: IO Int
readInt = fst . fromJust . C.readInt <$> C.getLine

main :: IO ()
main = do
  n <- readInt
  a <- readInt
  putStrLn $ canPay n a

canPay :: Int -> Int -> String
canPay n a = let r = n `rem` 500 in
  if r > a 
    then "No"
    else "Yes"