function Main(input) {
   input = input.split('\n');
   n = parseInt(input[0]);
   a = parseInt(input[1]);
   wattaamari = n % 500;
   if (wattaamari <= a) {
       console.log('Yes');
   } else {
       console.log('No');
   }
}
 Main(require('fs').readFileSync('/dev/stdin', 'utf8'));