#include <bits/stdc++.h>
using namespace std;
long long n, m;
long long x[200050];
long long s[200050];
long long dp[200050][85];
vector<pair<long long, long long> > ar;
long long rec(long long cu, long long j) {
  if (cu > m) return 0;
  if (dp[cu][j] != -1) return dp[cu][j];
  long long ans = 1e11;
  if (j != -1) ans = min(ans, 1 + rec(cu + 1, j));
  for (long long i = j + 1; i < n; i++) {
    long long left = x[i] - s[i];
    long long cost = 0;
    long long right = x[i] + s[i];
    if (cu < left) {
      cost += left - cu;
      right += left - cu;
    }
    if (right < cu) continue;
    ans = min(ans, rec(right + 1, i) + cost);
  }
  dp[cu][j] = ans;
  return ans;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> n >> m;
  ar.resize(n);
  for (int i = 0; i < n; i++) cin >> ar[i].first >> ar[i].second;
  sort(ar.begin(), ar.end());
  for (long long i = 0; i < n; i++) {
    x[i] = ar[i].first;
    s[i] = ar[i].second;
  }
  memset(dp, -1, sizeof(dp));
  cout << rec(1LL, -1LL);
  return 0;
}
