function main (input) {
  var line = input.split('\n');  
  line[0] = line[0].substr(-1*line[0].length ,3);
   while(line[0] > 500) line[0] -= 500;

  line[0]<=line[1] ? console.log('Yes') : console.log('No');

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