#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int n, m;
const int M = 1e5 + 5;
const int N = 82;
int dp[N][M];
pair<int, int> a[N];
int recur(int idx, int pos) {
  if (pos > m) return 0;
  int &res = dp[idx][pos];
  if (idx == n - 1) {
    res = max({0, m - a[n - 1].first - a[n - 1].second,
               a[n - 1].first - a[n - 1].second - pos});
    return res = min(res, m - pos + 1);
  }
  if (res != -1) return res;
  int req = max(0, a[idx].first - a[idx].second - pos);
  if (!req) {
    return res = recur(idx + 1, max(pos, a[idx].first + a[idx].second + 1));
  }
  int op2 = recur(idx + 1, pos);
  int op1 = req + recur(idx + 1, a[idx].first + a[idx].second + 1 + req);
  return res = min(op1, op2);
}
void solve() {
  cin >> n >> m;
  for (int i = 0; i < n; ++i) {
    cin >> a[i].first >> a[i].second;
  }
  sort(a, a + n);
  memset(dp, -1, sizeof dp);
  cout << recur(0, 1);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  solve();
}
