/*
TASK:colxor
LAnG:C++
*/
#include <iostream>
#include <algorithm>

using namespace std;

struct points{
              int x;
              int y;
              bool operator <(const points &b) const {return x<b.x;}            
       };

int n,r;
points a[1000];
long c[20001][20001];

void init(){
     cin>>n>>r;
     for(int i=0;i<n;i++)
         cin>>a[i].x>>a[i].y;
     sort(a,a+n); 
}

void build(){
     for(int i=0;i<n;i++){
         int h=(r+2)/2;
         if(r%2==0) h--;
         int xb=a[i].x-r;
         int xe=a[i].x+r;
         int yb=a[i].y+r;
         int ye=a[i].y-r;
         for(int j=ye;j<ye+r;j++){
             for(int k=xb+h-1;k<xe-h+1;k++){
                 c[j+10000][k+10000]++;
                 
         }
         if(h>1)h--;
     }
     }
     for(int i=0;i<n;i++){
         int h=(r+2)/2;
         if(r%2==0) h--;
         int xb=a[i].x-r;
         int xe=a[i].x+r;
         int yb=a[i].y+r;
         int ye=a[i].y-r;
         for(int j=yb-1;j>=yb-r;j--){
             for(int k=xb+h-1;k<xe-h+1;k++){
                 c[j+10000][k+10000]++;
                 
         }
         if(h>1)h--;
     }
     }
}

void solve(){
     build();  
     int ret=0;
     for(int i=0;i<n;i++){
         int xb=a[i].x-r;
         int xe=a[i].x+r;
         int yb=a[i].y+r;
         int ye=a[i].y-r;
         for(int j=ye;j<=yb;j++)
             for(int k=xb;k<=xe;k++)
                 if(c[j+10000][k+10000]!=0 && c[j+10000][k+10000]%2!=0) {
                    ret++;
                    c[j+10000][k+10000]=0;
                 }
     }
     cout<<ret<<"\n";
}

int main(){
    init();
    solve();
    return 0;
}
