import std.stdio;
import core.stdc.stdio;
import std.array;
import std.conv;
import std.algorithm;
import std.range;

void main() {
    int n,a; scanf("%d%d",&n,&a);
    int x = n % 500;
    writeln(x <= a ? "Yes" : "No");
}
