#include <bits/stdc++.h>
using namespace std;
vector<pair<long long, long long> > vec;
long long n, m;
bool mark[200005];
long long dp[100005][85];
long long call(long long pos, long long num) {
  if (pos > m) return 0;
  if (num == n) return m - pos + 1;
  long long &ret = dp[pos][num];
  if (ret != -1) return ret;
  ret = 9e18;
  ret = min(ret, call(pos, num + 1));
  long long cur = max(0LL, vec[num].first - pos);
  ret = min(ret, call(vec[num].second + cur + 1, num + 1) + cur);
  long long last;
  if (num == n - 1)
    last = m + 1;
  else
    last = vec[num + 1].first;
  long long b = last - vec[num].second - 1;
  long long a = call(last, num + 1) + max(cur, b);
  ret = min(ret, a);
  return ret;
}
int main() {
  long long x, s, i, j;
  memset(dp, -1, sizeof dp);
  scanf("%lld %lld", &n, &m);
  for (i = 1; i <= n; i++) {
    scanf("%lld %lld", &x, &s);
    long long a = max(1LL, x - s);
    long long b = min(m, x + s);
    vec.push_back({a, b});
  }
  long long last = 0;
  sort(vec.begin(), vec.end());
  n = vec.size();
  printf("%lld\n", call(1, 0));
}
