import Control.Monad
import Control.Applicative
import Data.List
import qualified Data.Map as Map
import Data.Array
import qualified Data.ByteString.Char8 as BC
import Data.Maybe
bsreadInt :: BC.ByteString -> Int
bsreadInt = fst . fromJust . BC.readInt
strToInt s = (read :: String -> Int) s

main = do

   n <- readLn :: IO Int
   a <- readLn :: IO Int
   
   if (mod n 500) <= a then putStrLn "Yes"
                       else putStrLn "No"
   
