#include <iostream>
#include <cstring>
#include <cstdio>
#include <algorithm>
using namespace std;
#define REP(i,n) for (int i=0;i<(n);i++)
#define FOR(i,a,b) for (int i=(a);i<=(b);i++)
#define FORD(i,b,a) for (int i=(b);i>=(a);i--)
#define MAXN 2010
#define x first
#define y second
typedef pair<int,int>pii;
int n,c,lo,hi,T[MAXN],P[MAXN],num,next[MAXN],prev[MAXN],ans;
pii p[MAXN];
bool used[MAXN];
void open(){
freopen("carnati.in","r",stdin);
freopen("carnati.out","w",stdout);
}
int main(){
open();
scanf("%d%d",&n,&c);
hi=0;
lo=1000000;
REP(i,n){
scanf("%d%d",&p[i].x,&p[i].y);
}
sort(p,p+n);
REP(i,n){
lo=0;hi=n-1;
while (p[lo].y<p[i].y) lo++;
while (p[hi].y<p[i].y) hi--;
num=0;
memset(prev,-1,sizeof(prev));
memset(next,-1,sizeof(next));
memset(used,0,sizeof(used));
FOR(j,lo,hi){
if (p[j].y>=p[i].y){
used[j]=1;
num++;
}
}
int now;
now=lo;
FOR(j,lo+1,hi){
if (used[j]){
prev[j]=now;
now=j;
}
}
now=hi;
FORD(j,hi-1,lo){
if (used[j]){
next[j]=now;
now=j;
}
}
int tmp,tmp2;
tmp=num*p[i].y-c*(p[hi].x-p[lo].x+1);
bool change=1;
while (change){
if (lo>=hi) break;
change=0;
if (next[lo]!=-1){
tmp2=tmp-p[i].y+c*(p[next[lo]].x-p[lo].x);
if (tmp2>tmp){
change=1;
num--;
tmp=tmp2;
lo=next[lo];
}
}
if (prev[hi]!=-1){
tmp2=tmp-p[i].y+c*(p[hi].x-p[prev[hi]].x);
if (tmp2>tmp){
change=1;
num--;
tmp=tmp2;
hi=prev[hi];
}
}
}
ans=max(ans,tmp);
}
printf("%d\n",ans);
//system("pause");
return 0;
}