function main(input) {
	const args = input.split('\n').map(n => parseInt(n, 10));
  	const N = args[0],
          A = args[1]
   
    let num = N % 500;
  	if (num <= A) {
      console.log('Yes');
    } else {
      console.log('No');
    }
}

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