#include <iostream>
#include <vector>
#include <algorithm>
#include <cassert>
struct DataStruct {
std::vector<int> arr, add;
const int GSIZE = 128;
DataStruct(int size, int value) {
arr.assign(size, value);
add.assign(size / GSIZE + 1, 0);
}
void push(int g) {
if (add[g] == 0) {
return;
}
const int begin = GSIZE * g;
const int after = std::min(begin + GSIZE, (int)arr.size());
int a = add[g];
for (int i = begin; i < after; ++i) {
arr[i] += a;
}
add[g] = 0;
}
void push_all() {
for (int g = 0; g < (int)add.size(); ++g) {
push(g);
}
}
void inc(int left, int right) {
assert(right < (int)arr.size());
int gl = left / GSIZE;
int gr = right / GSIZE;
if (gl == gr) {
push(gl);
for (int i = left; i <= right; ++i) {
arr[i]++;
}
} else {
push(gl);
push(gr);
for (int i = left, after = (gl+1) * GSIZE; i < after; ++i) {
arr[i]++;
}
for (int g = gl+1; g < gr; ++g) {
add[g]++;
}
for (int i = gr * GSIZE; i <= right; ++i) {
arr[i]++;
}
}
}
};
int main() {
std::ios_base::sync_with_stdio(false);
std::cin.tie(0); std::cout.tie(0); std::cerr.tie(0);
int n, last;
std::cin >> n >> last;
DataStruct ds(last+1, 0);
for (int i = 0; i < n; ++i) {
int x, p; std::cin >> x >> p;
int l = std::max(0, x-p);
int r = std::min(last, x+p);
ds.inc(l, r);
}
ds.push_all();
for (auto& it : ds.arr) if (it > 1) it = 0;
int answ = 0;
for (int i = 0; i <= last;) {
while (i <= last && ds.arr[i] == 1) ++i;
if (i > last) break;
int j = i;
while (j <= last && ds.arr[j] == 0) ++j;
answ = std::max(answ, j-i);
i = j;
}
std::cout << answ;
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8dmVjdG9yPgojaW5jbHVkZSA8YWxnb3JpdGhtPgojaW5jbHVkZSA8Y2Fzc2VydD4KCnN0cnVjdCBEYXRhU3RydWN0IHsKICAgIHN0ZDo6dmVjdG9yPGludD4gYXJyLCBhZGQ7CiAgICAKICAgIGNvbnN0IGludCBHU0laRSA9IDEyODsKICAgIAogICAgRGF0YVN0cnVjdChpbnQgc2l6ZSwgaW50IHZhbHVlKSB7CiAgICAgICAgYXJyLmFzc2lnbihzaXplLCB2YWx1ZSk7CiAgICAgICAgYWRkLmFzc2lnbihzaXplIC8gR1NJWkUgKyAxLCAwKTsKICAgIH0KICAgIAogICAgdm9pZCBwdXNoKGludCBnKSB7CiAgICAgICAgaWYgKGFkZFtnXSA9PSAwKSB7CiAgICAgICAgICAgIHJldHVybjsKICAgICAgICB9CiAgICAgICAgY29uc3QgaW50IGJlZ2luID0gR1NJWkUgKiBnOwogICAgICAgIGNvbnN0IGludCBhZnRlciA9IHN0ZDo6bWluKGJlZ2luICsgR1NJWkUsIChpbnQpYXJyLnNpemUoKSk7CiAgICAgICAgaW50IGEgPSBhZGRbZ107CiAgICAgICAgZm9yIChpbnQgaSA9IGJlZ2luOyBpIDwgYWZ0ZXI7ICsraSkgewogICAgICAgICAgICBhcnJbaV0gKz0gYTsKICAgICAgICB9CiAgICAgICAgYWRkW2ddID0gMDsKICAgIH0KICAgIAogICAgdm9pZCBwdXNoX2FsbCgpIHsKICAgICAgICBmb3IgKGludCBnID0gMDsgZyA8IChpbnQpYWRkLnNpemUoKTsgKytnKSB7CiAgICAgICAgICAgIHB1c2goZyk7CiAgICAgICAgfQogICAgfQogICAgCiAgICB2b2lkIGluYyhpbnQgbGVmdCwgaW50IHJpZ2h0KSB7CiAgICAgICAgYXNzZXJ0KHJpZ2h0IDwgKGludClhcnIuc2l6ZSgpKTsKICAgICAgICBpbnQgZ2wgPSBsZWZ0IC8gR1NJWkU7CiAgICAgICAgaW50IGdyID0gcmlnaHQgLyBHU0laRTsKICAgICAgICBpZiAoZ2wgPT0gZ3IpIHsKICAgICAgICAgICAgcHVzaChnbCk7CiAgICAgICAgICAgIGZvciAoaW50IGkgPSBsZWZ0OyBpIDw9IHJpZ2h0OyArK2kpIHsKICAgICAgICAgICAgICAgIGFycltpXSsrOwogICAgICAgICAgICB9CiAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgcHVzaChnbCk7CiAgICAgICAgICAgIHB1c2goZ3IpOwogICAgICAgICAgICBmb3IgKGludCBpID0gbGVmdCwgYWZ0ZXIgPSAoZ2wrMSkgKiBHU0laRTsgaSA8IGFmdGVyOyArK2kpIHsKICAgICAgICAgICAgICAgIGFycltpXSsrOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGZvciAoaW50IGcgPSBnbCsxOyBnIDwgZ3I7ICsrZykgewogICAgICAgICAgICAgICAgYWRkW2ddKys7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZm9yIChpbnQgaSA9IGdyICogR1NJWkU7IGkgPD0gcmlnaHQ7ICsraSkgewogICAgICAgICAgICAgICAgYXJyW2ldKys7CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICB9Cn07CgoKaW50IG1haW4oKSB7CiAgICBzdGQ6Omlvc19iYXNlOjpzeW5jX3dpdGhfc3RkaW8oZmFsc2UpOwogICAgc3RkOjpjaW4udGllKDApOyBzdGQ6OmNvdXQudGllKDApOyBzdGQ6OmNlcnIudGllKDApOwogICAgCiAgICBpbnQgbiwgbGFzdDsKICAgIHN0ZDo6Y2luID4+IG4gPj4gbGFzdDsKICAgIAogICAgRGF0YVN0cnVjdCBkcyhsYXN0KzEsIDApOwogICAgCiAgICBmb3IgKGludCBpID0gMDsgaSA8IG47ICsraSkgewogICAgICAgIGludCB4LCBwOyBzdGQ6OmNpbiA+PiB4ID4+IHA7CiAgICAgICAgaW50IGwgPSBzdGQ6Om1heCgwLCB4LXApOwogICAgICAgIGludCByID0gc3RkOjptaW4obGFzdCwgeCtwKTsKICAgICAgICBkcy5pbmMobCwgcik7CiAgICB9CiAgICBkcy5wdXNoX2FsbCgpOwogICAgZm9yIChhdXRvJiBpdCA6IGRzLmFycikgaWYgKGl0ID4gMSkgaXQgPSAwOwogICAgaW50IGFuc3cgPSAwOwogICAgZm9yIChpbnQgaSA9IDA7IGkgPD0gbGFzdDspIHsKICAgICAgICB3aGlsZSAoaSA8PSBsYXN0ICYmIGRzLmFycltpXSA9PSAxKSArK2k7CiAgICAgICAgaWYgKGkgPiBsYXN0KSBicmVhazsKICAgICAgICBpbnQgaiA9IGk7CiAgICAgICAgd2hpbGUgKGogPD0gbGFzdCAmJiBkcy5hcnJbal0gPT0gMCkgKytqOwogICAgICAgIGFuc3cgPSBzdGQ6Om1heChhbnN3LCBqLWkpOwogICAgICAgIGkgPSBqOwogICAgfQogICAgc3RkOjpjb3V0IDw8IGFuc3c7CiAgICByZXR1cm4gMDsKfQ==