'use strict'

const main = input => {
	const args = input.split('\n')
	const n = parseInt(args[0], 10)
	const a = parseInt(args[1], 10)

	if (n % 500 <= a) console.log('Yes')
	else console.log('No')
}

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