var main = function main(input) {
  var args = input.split('\n')
  var pay = +args[0]
  var oneCoins = +args[1]
  var rest = pay % 500
  if (rest - oneCoins > 0) {
      console.log('No')
  } else {
      console.log('Yes')
  }

}
 
main(require('fs').readFileSync('/dev/stdin', 'utf-8'))
