function Main(input) {
	input = input.trim();
	//input = input.trim().split(" ");
	//input = input.trim().split("\n");
	//input = input.trim().split(" ").map((a)=>Number(a));
	input = input.trim().split("\n").map((a)=>Number(a));
  	var N = input[0];
  var A = input[1];
  if((N % 500) - A >= 0){
     console.log("Yes");
     }else{
      console.log("No"); 
     }
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));
