'use strict'

function main(input) {
  input = input
    .trim()
    .split('\n')
    .map(Number)
  const n = input[0] % 500
  const ans = n <= input[1] ? 'Yes' : 'No'
  console.log(ans)
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'))