// Arup Guha
// Solution to 2013 November Silver Problem: Crowded Cows
// 7/2/2015

import java.util.*;
import java.io.*;

public class crowded {

	public static void main(String[] args) throws Exception {

		BufferedReader stdin = new BufferedReader(new FileReader("crowded.in"));
		StringTokenizer tok = new StringTokenizer(stdin.readLine());
		int n = Integer.parseInt(tok.nextToken());
		int gap = Integer.parseInt(tok.nextToken());

		// Read in cows.
		cow[] cows = new cow[n];
		for (int i=0; i<n; i++) {
			tok = new StringTokenizer(stdin.readLine());
			int loc = Integer.parseInt(tok.nextToken());;
			int height = Integer.parseInt(tok.nextToken());;
			cows[i] = new cow(loc, height, i);
		}

		// Sort and put in interval tree.
		Arrays.sort(cows);
		IntTree itree = new IntTree(0, n-1);
		for (int i=0; i<n; i++)
			itree.change(i,i,cows[i].height);

		// Go through each cow to see if it's crowded.
		int res = 0;

		// Keeps indexes of lowest and highest cow with d of current cow.
		int low = 0, high = 0;
		for (int i=0; i<n; i++) {

			// Update our pointers.
			while (low < n && cows[low].loc+gap < cows[i].loc) low++;
			while (high < n && cows[high].loc <= cows[i].loc + gap) high++;
			high--;

			// Now search for tall cows on left and right.
			int left = low <= i-1 ?   itree.query(low, i-1) : 0;
			int right = high >= i+1 ? itree.query(i+1, high): 0;

			// Update result if necessary.
			if (left >= 2*cows[i].height && right >= 2*cows[i].height) res++;
		}

		PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter("crowded.out")));
		out.println(res);
		out.close();
	}
}

class cow implements Comparable<cow> {

	public int loc;
	public int height;
	public int ID;

	public cow(int myLoc, int myH, int i) {
		loc = myLoc;
		height = myH;
		ID = i;
	}

	public int compareTo(cow other) {
		if (this.loc != other.loc) return this.loc - other.loc;
		return this.ID - other.ID;
	}
}

class IntTree {

	// Stores range for this node.
	public int low;
	public int high;

	// Stores aggregate data for this node.
	public int delta;
	public int value;

	// Pointers to children.
	public IntTree left;
	public IntTree right;

	// Creates an interval tree from myLow to myHigh, inclusive.
	public IntTree(int myLow, int myHigh) {

		low = myLow;
		high = myHigh;
		delta = 0;
		value = 0;

		// Lowest level.
		if (low == high) {
			left = null;
			right = null;
		}

		// Must create more nodes.
		else {
			int mid = (low+high)/2;
			left = new IntTree(low, mid);
			right = new IntTree(mid+1, high);
		}
	}

	// Propogates a change down to child nodes.
	public void prop() {

		// Recursive case, push down.
		if (left != null) {
			left.delta += delta;	/*** can change ***/
			right.delta += delta;	/*** can change ***/
			delta = 0;
		}

		// I put this in, seems to make sense.
		else {
			value += delta; /*** Can change - set for sum now ***/
			delta = 0;
		}
	}

	// Pre-condition: delta is 0.
	public void update() {
		if (left != null)
			value = Math.max(left.value+left.delta, right.value+right.delta);
	}

	// Changes the values in the range [start, end] by "adding" extra.
	public void change(int start, int end, int extra) {

		// Out of range.
		if (high < start || end < low) return;

		// Push down delta.
		prop();

		// Whole range must be updated.
		if (start <= low && high <= end) {
			delta += extra;		/*** Can change ***/
			update();
			return;
		}

		// Portions of children have to be changed instead.
		left.change(start, end, extra);
		right.change(start, end, extra);
		update();
	}

	public int query(int start, int end) {

		// Out of range.
		if (high < start || end < low) return 0; /*** Can change ***/

		// Whole range must be returned;
		if (start <= low && high <= end) {
			return value + delta;
		}

		// Get answers from both potions.
		prop();
		int leftSide = left.query(start, end);
		int rightSide = right.query(start, end);
		update();
		return Math.max(leftSide, rightSide);
	}
}