import Control.Monad
import Data.Maybe
import qualified Data.ByteString.Char8 as BS

readInt = fst . fromJust . BS.readInteger
readIntList = map readInt . BS.words
getIntList = readIntList <$> BS.getLine
getIntMatrix = map readIntList . BS.lines <$> BS.getContents
main = do
    argMatrix <- getIntMatrix
    putStrLn $ solve argMatrix


solve :: [[Integer]] -> String
solve argMatrix = if aMod > a
                  then "No"
                  else "Yes" 
    where
        n = head $ head argMatrix
        a = head $ last argMatrix
        aMod = mod n 500