#include <bits/stdc++.h>
using namespace std;
constexpr int MAXN = 80, MAXM = 100000, INF = INT_MAX / 2;
pair<int, int> ant[MAXN + 2];
int dp[MAXM + 2];
int main() {
  int n, m;
  cin >> n >> m;
  for (int i = 0; i < n; i++) cin >> ant[i].first >> ant[i].second;
  sort(ant, ant + n);
  ant[n].first = INT_MAX;
  fill(dp, dp + m + 1, INF);
  for (int i = 1; i <= m; i++) {
    for (int j = 0; ant[j].first <= i; j++) {
      auto [x, s] = ant[j];
      int alt = min(2 * x - i, x - s) - 1;
      if (alt <= 0)
        alt = 0;
      else
        alt = dp[alt];
      int val = max(0, i - (x + s));
      dp[i] = min(dp[i], min(max(val, x - s - 1), alt + val));
    }
    bool cov = false;
    for (int j = 0; j < n; j++) {
      auto [x, s] = ant[j];
      if (x - s <= i && i <= x + s) {
        cov = true;
        break;
      }
    }
    dp[i] = min(dp[i], dp[i - 1] + !cov);
  }
  cout << dp[m] << '\n';
}
