function main (input) {
  var N = parseInt(input.split('\n')[0]);
  var a = parseInt(input.split('\n')[1]);

  Nperfh = N % 500;
  if (a >= Nperfh) {
    console.log('Yes');
  } else {
    console.log('No');
  }
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));