'use strict';

const receive = require('fs')
  .readFileSync('/dev/stdin', 'utf8')
  .split(/\s/);

const main = input => {
  const N = input[0];
  const A = Number(input[1]);

  const rest = N % 500;
  const ans = A >= rest ? "Yes" : "No";

  console.log(ans);
};

main(receive);