#include <bits/stdc++.h>
using namespace std;
#define x first
#define y second
typedef pair<int, int> PII;
typedef long long ll;
const int N = 1e5 + 10;
int n, len;
PII a[N];
bool cmp(PII a, PII b)
{
return a.x + a.y < b.x + b.y;
}
bool check(ll t)
{
ll l = -2e9, r = -2e9;
for (int i = 1; i <= n; i++)
{
ll lt = max(a[i].x + a[i].y - t, 1ll), rt = a[i].x - a[i].y + t;
if (lt > rt)
continue;
if (l == -2e9)
l = lt, r = rt;
if (i != 1 && r + 1 >= lt)
r = max(r, rt);
else false;
}
return l == 1 && r >= len;
}
int main()
{
cin >> n >> len;
for (int i = 1; i <= n; i++)
{
ll pos, s;
cin >> pos >> s;
a[i] = {pos, s};
}
sort(a + 1, a + n + 1, cmp);
ll l = 0, r = 2e9 + 10;
while (l < r)
{
ll mid = l + r >> 1;
if (check(mid))
r = mid;
else
l = mid + 1;
}
cout << l;
}