#include <cstdio>
#include <algorithm>
#include <string.h>
#include <math.h>
using namespace std;

#define Nmax 100010

struct segment {
	int x1, y1, x2, y2;
} L[Nmax], A[Nmax], B[Nmax];

struct punct {
	int x, y;
} P[Nmax], Aux[Nmax];

int n, d, N, a, b;

long double Dist (long double x1, long double y1, long double x2, long double y2) {
	
	return sqrt ( (x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1));
}

bool cmp (const segment &a, const segment &b) {
	return a.x1 < b.x1;
}

bool egal (double a,double b) {
	
	a-= b;
	if (a < 0) a = -a;
	if ((long double)a <= (long double)0.0000001) return 1;
	return 0;
}

void rezolva () {

	int p, u, sol = 0, infinit = 0;
	double X1, X2, Y1, Y2;
	double D1, D2, D = (double) d;
	
	// sort (L + 1, L + N + 1, cmp);
	
	sort (A + 1, A + a + 1, cmp);
	sort (B + 1, B + b + 1, cmp);
	
	for (p = 1, u = 1; p <= a && u <= b;) {
		
		X1 = max (A[p].x1, B[u].x1);
		X2 = min (A[p].x2, B[u].x2);
		
		if (A[p].x2 != A[p].x1) Y1 = (long double)(X1 - A[p].x1) * (long double)(A[p].y2 - A[p].y1) / (long double)(A[p].x2 - A[p].x1) + (long double)A[p].y1;
		else Y1 = min (A[p].y1, A[p].y2);
		
		if (B[u].x1 != B[u].x2) Y2 = (long double)(X1 - B[u].x1) * (long double)(B[u].y2 - B[u].y1) / (long double)(B[u].x2 - B[u].x1) + (long double)B[u].y1;
		else Y2 = max (B[u].y1, B[u].y2);
		
		D1 = Dist (X1, Y1, X1, Y2);
		
		if (A[p].x2 != A[p].x1) Y1 = (long double)(X2 - A[p].x1) * (long double)(A[p].y2 - A[p].y1) / (long double)(A[p].x2 - A[p].x1) + (long double)A[p].y1;
		else Y1 = min (A[p].y1, A[p].y2);
		
		if (B[u].x1 != B[u].x2) Y2 = (long double)(X2 - B[u].x1) * (long double)(B[u].y2 - B[u].y1) / (long double)(B[u].x2 - B[u].x1) + (long double)B[u].y1;
		else Y2 = max (B[u].y1, B[u].y2);
		
		D2 = Dist (X1, Y1, X1, Y2);
		
		if ( egal (D1, D) && egal (D, D2)) {
			infinit = 1;
			break;
		}
		
		if (D1 <= D2) {
			if ((D1 < D || egal (D1, D)) && (D < D2 || egal (D, D2)) && (!egal (D, D2))) 
				sol++;
		}
		else 
			if ((D2 < D || egal (D2, D)) && (D < D1 || egal (D, D1)) && (!egal (D, D2))) 
				sol++;
		
		if (A[p].x2 == B[u].x2) {
			p++; u++;
		}
		else {
			if (A[p].x2 <= B[u].x2) p++;
			else u++;
		}
	}
	
	if (A[a].x1 == A[a].x2 && abs(A[a].y1 - A[a].y2) == d) sol++;
	
	if (!infinit) printf ("%d\n", sol);
	else printf ("infinit");
}

void citire () {
	
	int i, xmin = 100000001, pmin;
	
	scanf ("%d %d", &n, &d);
	for (i = 1; i <= n; i++) {
		scanf ("%d %d", &Aux[i].x, &Aux[i].y);
		if (Aux[i].x < xmin) {
			xmin = Aux[i].x;
			pmin = i;
		}
	}
	
	N = 0;
	for (i = pmin; ;) {
		P[++N] = Aux[i];
		
		i++;
		if (i == n + 1) i = 1;
		if (i == pmin) break;
	}
	
	P[n + 1] = P[1];
	for (i = 1; i <= n; i++) {
		if (P[i].x <= P[i + 1].x) {
			a++;
			A[a].x1 = P[i].x; A[a].y1 = P[i].y;
			A[a].x2 = P[i + 1].x; A[a].y2 = P[i + 1].y;
		}
		else {
			b++;
			B[b].x1 = P[i + 1].x; B[b].y1 = P[i + 1].y;
			B[b].x2 = P[i].x; B[b].y2 = P[i].y;
		}
	}
}

int main () {

	freopen ("monoton.in", "r", stdin);
	freopen ("monoton.out", "w", stdout);
	
	citire ();
	rezolva ();
	
	return 0;
}
