main = do
    fee <- readLn :: IO Int
    n   <- readLn :: IO Int
    putStrLn $ solve fee n

solve :: Int -> Int -> String
solve fee n
    | fee `mod` 500 <= n = "Yes"
    | otherwise          = "No"