import Control.Applicative
import Control.Monad
import Data.List
import Data.Array
import Data.Char

main = do
  n <- (read::String -> Int) <$> getLine
  a <- (read::String -> Int) <$> getLine
  putStrLn $ if n `mod` 500 <= a then "Yes" else "No"

