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

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

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