import Control.Applicative ((<$>), (<*>))

main :: IO ()
main = solve <$> readLn <*> readLn >>= putStrLn

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

