#include <bits/stdc++.h>
const double eps = (1e-9);
using namespace std;
int dcmp(long double a, long double b) {
  return fabsl(a - b) <= eps ? 0 : (a > b) ? 1 : -1;
}
int getBit(long long num, int idx) { return ((num >> idx) & 1ll) == 1; }
int setBit1(int num, int idx) { return num | (1 << idx); }
long long setBit0(long long num, int idx) { return num & ~(1ll << idx); }
long long flipBit(long long num, int idx) { return num ^ (1ll << idx); }
void M() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}
int countNumBit1(int mask) {
  int ret = 0;
  while (mask) {
    mask &= (mask - 1);
    ++ret;
  }
  return ret;
}
const int N = 100000 + 9, NN = 85;
int mem[N], m, n, x[NN], s[NN];
int solve(int id) {
  if (id > m) return 0;
  int &ret = mem[id];
  if (ret != -1) return ret;
  int ans = m + 1;
  for (int i = 1; i <= n; i++) {
    int L = x[i] - s[i];
    int R = x[i] + s[i];
    if (id >= L && id <= R) {
      ans = min(ans, solve(id + 1));
    } else if (id < L) {
      ans = min(ans, solve(R + (L - id) + 1) + (L - id));
    } else {
      ans = min(ans, solve(id + 1) + 1);
    }
  }
  return ret = ans;
}
int main() {
  M();
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    cin >> x[i] >> s[i];
  }
  memset(mem, -1, sizeof(mem));
  cout << solve(1) << endl;
}
