'use strict'

function main(input) {
    input = input.split(/\n|\s/).map(v => ~~v)

    let ans = 'No'
    if (input[1] >= input[0] % 500) ans = 'Yes'

    console.log(ans)

}

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