function main (input) {
  const N = parseInt(input.split('\n')[0]);
  const a = parseInt(input.split('\n')[1]);
 
  console.log(N % 500 <= a ? "Yes" : "No");
  Nperfh = N % 500;
}
 
main(require('fs').readFileSync('/dev/stdin', 'utf8'));