main = do
  ns <- fmap (fmap (read :: String -> Int) . words) . lines <$> getContents
  let n = head $ head ns
  let a = head $ last ns
  putStrLn $ solve n a

solve :: Int -> Int -> String
solve n a = if calc n a then "Yes" else "No"

calc :: Int -> Int -> Bool
calc n a = m <= a
  where
    m = mod n 500