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

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

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