function main(input) {
    const args = input.split('\r\n');
    const a = parseInt(args[0], 10);
    const n = parseInt(args[1], 10);

    if (a < 500 || n % 500 === 0) {
        console.log('No');
    } else {
        console.log('Yes');
    }
}

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