#include <bits/stdc++.h>
using namespace std;
struct wor {
  int x, y;
  bool start;
};
struct node {
  int maxN;
  int plus;
};
vector<node> t(16 * 1000000 + 1000, {0, 0});
int m = 4 * 1000000 + 5;
bool operator<(wor a, wor b) { return a.y < b.y or a.y == b.y and a.x < b.x; }
void update(int v, int l, int r, int a, int b, int val) {
  if (l >= b or r <= a) {
    return;
  } else if (a <= l and r <= b) {
    t[v].plus += val;
  } else {
    int m = (l + r) / 2;
    update(2 * v + 1, l, m, a, b, val);
    update(2 * v + 2, m, r, a, b, val);
    t[v].maxN = max(t[2 * v + 1].maxN + t[2 * v + 1].plus,
                    t[2 * v + 2].maxN + t[2 * v + 2].plus);
  }
}
int query(int v, int l, int r, int a, int b) {
  if (l >= b or r <= a) {
    return -1;
  } else if (a <= l and r <= b) {
    return t[v].maxN + t[v].plus;
  } else {
    int m = (l + r) / 2;
    t[2 * v + 1].plus += t[v].plus;
    t[2 * v + 2].plus += t[v].plus;
    t[v].maxN = t[v].maxN + t[v].plus;
    t[v].plus = 0;
    return max(query(2 * v + 1, l, m, a, b), query(2 * v + 2, m, r, a, b));
  }
}
int main() {
  int add = 1000000;
  ios_base ::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  int r;
  cin >> r;
  r *= 2;
  vector<wor> a(2 * n);
  for (int i = 0; i < n; i++) {
    int x, y;
    cin >> x >> y;
    int newX = x + y;
    int newY = x - y;
    newX += add;
    newY += add;
    a[2 * i] = {newX, newY, true};
    a[2 * i + 1] = {newX, newY + r + 1, false};
  }
  int best = 0;
  sort(a.begin(), a.end());
  for (auto e : a) {
    if (e.start) {
      update(0, 0, m, e.x, e.x + r + 1, 1);
      int q = query(0, 0, m, e.x, e.x + r + 1);
      best = max(best, q);
    } else {
      update(0, 0, m, e.x, e.x + r + 1, -1);
    }
  }
  cout << best;
  return 0;
}
