function main(input) {
  input=input.trim();
  const n = parseInt(input.split("\n")[0], 10);
  const a = parseInt(input.split("\n")[1], 10);
  var wari = n%500;
  if(wari<=a){
    console.log("Yes");
  }else{
    console.log("No");
  }
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

