"use strict"

const Main = (input)=>{
const Array =input.split(/\n/)
const N =parseInt(Array[0],10)
const A =parseInt(Array[1],10)
const result = (N % 500) <= A
console.log(result?"Yes":"No" )

}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));