#include <bits/stdc++.h>
using namespace std;
int m[16001000], g[16001000];
int u[4000000], v[4000000], pos[4000000];
int x, y, N;
bool cmp(int a, int b) {
  if (v[a] < v[b]) return true;
  return false;
}
void them(int l, int r, int x, int y, int i, int gt) {
  if (g[i] != 0) {
  }
  if (l > y || r < x) return;
  if (x <= l && r <= y) {
    m[i] += gt;
    if (l != r) g[i] += gt;
  } else {
    g[i * 2] += g[i];
    g[i * 2 + 1] += g[i];
    m[i * 2] += g[i];
    m[i * 2 + 1] += g[i];
    g[i] = 0;
    them(l, (l + r) / 2, x, y, i * 2, gt);
    them((l + r) / 2 + 1, r, x, y, i * 2 + 1, gt);
    m[i] = max(m[i * 2], m[i * 2 + 1]);
  }
}
int main() {
  iostream::sync_with_stdio(false);
  int n, r;
  int oo = 4000000;
  cin >> n >> r;
  N = 0;
  for (int i = 0; i < n; i++) {
    cin >> x >> y;
    x = x + 1000000 * 2;
    u[i] = x - y;
    v[i] = x + y;
    pos[i] = i;
  }
  sort(pos, pos + n, cmp);
  int ans = 0;
  int p = -1;
  for (int i = 0; i < n; i++) {
    while ((p < n - 1) && (v[pos[p + 1]] <= v[pos[i]] + r * 2)) {
      p++;
      them(0, oo, max(u[pos[p]] - r * 2, 0), u[pos[p]], 1, 1);
    }
    ans = max(ans, m[1]);
    them(0, oo, max(u[pos[i]] - r * 2, 0), u[pos[i]], 1, -1);
  }
  cout << ans;
  return 0;
}
