{-# OPTIONS_GHC -O2 -funbox-strict-fields #-}

main :: IO ()
main = do
  n <- readLn
  a <- readLn
  putStrLn $ if solve n a then "Yes" else "No"

solve :: Int -> Int -> Bool
solve n a = n `mod` 500 <= a
