function main( input ) {
    const [N, A] = input.split('\n');
    if( N % 500 - A > 0 ) {
        console.log('No');
    } else {
        console.log('Yes');
    }
}

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