"use strict"
function Main(input) {
  const params = input.split('\n').map(Number);
  const n = params[0];
  const a = params[1];
  const fraction = n % 500;
 
  if (fraction <= a) {
    console.log('Yes');
  } else {
    console.log('No');
  }
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));