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