function main (s) {
	s=s.split("\n");
	var n=Number(s[0]);
	var a=Number(s[1]);
	if(n%500<=a)console.log("Yes\n");
	else console.log("No\n");
}
 
main(require('fs').readFileSync('/dev/stdin', 'utf8'));