#include<cstdio>
#include<algorithm>
using namespace std;

struct drepte{int x1,y1,x2,y2;} m1[100010],m2[100010];
struct punct{int x,y;}p[ 100010 ];
int n,i,d,sol;

void citire(){
	freopen("monoton.in","r",stdin);
	int i;
	
	scanf("%d %d",&n,&d);
	for(i = 1;i <= n; i++)
		scanf("%d %d",&p[i].x,&p[i].y);
	
}

bool cmp( drepte a,drepte b){
	return a.x1 < b.x1;}

double dist(int x,int y,drepte m){
	if(m.y1 == m.y2)
		{if(y > m.y1)
			return y - m.y1;
		else
			return m.y1 - y;
		}
	
	
double p1,p2,p3,Y;
p1 = m.x2 - m.x1;
p2 = m.y2 - m.y1;
p3 = x - m.x1;

Y = (p3 * p2)/p1;
Y += m.y1;

if(Y > double(y))
	return Y - double(y);
else
	return double(y) - Y;


}

void calculations(int a,int b,double &d1,double &d2){
//calculeaza d1
	if(m1[a].x1 >m2[b].x1)
		d1 = dist(m1[a].x1,m1[a].y1,m2[b]);
	else
		d1 = dist(m2[b].x1,m2[b].y1,m1[a]);
	
//calculeaza d2
	if(m1[a].x2 > m2[b].x2)
		d2 =dist(m2[b].x2,m2[b].y2,m1[a]);
	else
		d2 = dist(m1[a].x2,m1[a].y2,m2[b]);



}


void solve(){
/// calculat dreptele
p[n+1] = p[1];

int i,a,b,aux;
 a = b = 0;
for(i= 1 ;i<=n;i++)
	if(p[i].x < p[i+1].x)
		{a++;
		m1[a].x1 = p[i].x;
		m1[a].y1 = p[i].y;
		m1[a].x2 = p[i+1].x;
		m1[a].y2 = p[i+1].y;
		}
	else
		{b++;
		m2[b].x1 = p[i+1].x;
		m2[b].y1 = p[i+1].y;
		m2[b].x2 = p[i].x;
		m2[b].y2 = p[i].y;
		if(m2[b].x1 == m2[b].x2)
			{aux = m2[b].y1 - m2[b].y2;
			if(aux <0)
				aux = 0-aux;
			if(aux > d)
				{sol = -1;return;}
			b--;}
		}
sort(m2+1,m2+1+b,cmp);
int k1,k2;
double d1,d2;
k1 = k2 = 1;
	while(k1 <=a && k2<=b)
		{calculations(k1,k2,d1,d2);
		if(d1 == d2 && d2 == (double)d)
			{sol = -1;
			return;
			}
		else
		if(d1 == (double)d )//|| d2 == (double)d)
			sol++;
		else
		if(d1 < (double)d && d2 > (double)d )
			sol++;
		else
		if(d2 <(double) d && d1 > (double)d)
			sol++;
		if(m1[k1].x2 < m2[k2].x2)
			k1++;
		else
			if(m2[k2].x2 < m1[k1].x2)
				k2++;
		else
		if(m1[k1].x2 == m2[k2].x2)
			{k1++;
			k2++;
			}
		}
		
}

void afisare(){
freopen("monoton.out","w",stdout);
if(sol>0)
	printf("%d\n",sol);
else
	printf("infinit\n");
}


int main(){
citire();
solve();
afisare();
return 0;}

