function Main(input){
  input = input.split("\n");
  var N=Number(input[0]);
  var A=Number(input[1]);
  if(N%500>A){
    console.log('No');
  }else{
    console.log('Yes');
  }
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));