function Main(input) {
  input = input.split('\n').map(num => Number(num));
  payment = input[0];
  sheets = input[1];
  if (payment % 500 <= sheets) {
    console.log('Yes');
  } else {
    console.log('No');
  }
}

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