#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;
}