#include <bits/stdc++.h>
using namespace std;
const int N = 85, M = 1e5 + 5;
const int inf = 1e7;
int n, m, x[N], second[N], dp[M];
int solve(int idx) {
  if (idx > m) return 0;
  int &ret = dp[idx];
  if (ret != -1) return ret;
  ret = inf;
  for (int i = 0; i < n; ++i) {
    if (x[i] - second[i] <= idx && x[i] + second[i] >= idx) {
      ret = min(ret, solve(x[i] + second[i] + 1));
    } else if (x[i] > idx) {
      ret = min(ret, x[i] - second[i] - idx + solve(2 * x[i] - idx + 1));
    }
  }
  if (ret == inf) ret = m - idx + 1;
  return ret;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> m;
  for (int i = 0; i < n; ++i) {
    cin >> x[i] >> second[i];
  }
  memset(dp, -1, sizeof(dp));
  cout << solve(1) << endl;
  return 0;
}
