"use strict"

const main = (input) => {
    input = input.split("\n");
    const N = Number(input[0]);
    const A = Number(input[1]);

    if ((N - A) % 500 === 0 || (N - A) <= 0) {
        console.log("Yes");
    } else {
        console.log("No");
    }
};

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