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

canPay
  :: Int -> Int -> Bool
canPay n a = let r = n `rem` 500 in
  if r <= a
    then True
    else False

canPay'
  :: Int -> Int -> String
canPay' n a
  | canPay n a = "Yes"
  | otherwise  = "No"