#include<bits/stdc++.h>
using namespace std;

int main(){
  ios::sync_with_stdio(0);
  int n, a;
  cin >> n >> a;
  int k = n%500;
    if(k<=a)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}
