function Main(inp) {
    var input = inp.split("\n").map(function(n) { return Number(n);});
    var n = input[0];
    var a = input[1];
    if (Math.floor(n % 500) <= a) {
        console.log('Yes');
        return;        
    }
    console.log('No');
}

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