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