#include <stdio.h>
#include <string.h>
int main(){
    int N,A;
    char s[80];
  	scanf("%s",s);
    N = atoi(s);
  	scanf("%s",s);
    A = atoi(s);
    N%=500;
    if(N<=A){
  		printf("Yes");
    }else{
      	printf("No");
    }
    return 0;
}