function Main(input) {
  var inputs = input.split("\n").map(num => parseInt(num, 10));
  var n = inputs[0];
  var a = inputs[1];

  if (n % 500 <= a) {
    console.log("Yes");
  } else {
    console.log("No");
  }
}

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