process.stdin.resume();
process.stdin.setEncoding('utf8');
var is = '';

process.stdin.on('data', (ch) => {
  is += ch;
});

process.stdin.on('end', () => {
  var l = is.split('\n')
    , n = l[0]
    , a =l[1];
  console.log(n >= 500 && n % 500 - 1 * a <= 0 ? 'Yes' : 'No');
});