const input = require("fs").readFileSync("/dev/stdin", "utf8");

function Main(input) {
  const [N, A] = input.split('\n').map(Number);
  console.log(N%500 <= A?'Yes':'No');
}

// Don't edit this line!
Main(input);