#include<stdio.h>

int int_comp(const void *_a, const void *_b)
{
  int a = *(int *)_a;
  int b = *(int *)_b;
  if (a < b) {
    return -1;
  } else if (a > b) {
    return 1;
  } else {
    return 0;
  }
}

int main() {
  int V,d,count=0;
  while(scanf("%d%d",&V,&d) != EOF) {
    int i,fib[V];
    fib[0]=2,fib[1]=3;
    for(i=2; i<V; i++) fib[i] = ((fib[i-1]+fib[i-2])>1001)? (fib[i-1]+fib[i-2]-1001):(fib[i-1]+fib[i-2]);
    qsort(fib,V,sizeof(int), int_comp);
    for(i=1; i<V; i++)
      if((fib[i] - fib[i-1]) >= d) count++;
    printf("%d\n",++count);
    count=0;
  }
  return 0;
}