#include <bits/stdc++.h>
using namespace std;
const double pi = acos(-1);
const long long mod = 1e9 + 7;
inline long long read() {
  long long x = 0, f = 1;
  char ch = getchar();
  while (ch > '9' || ch < '0') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * f;
}
int n, m;
int f[100005], x[100], s[100];
int main() {
  int i, j;
  n = read(), m = read();
  for (i = 1; i <= n; i++) x[i] = read(), s[i] = read();
  for (i = 1; i <= m; i++) f[i] = i;
  for (i = 1; i <= m; i++) {
    for (j = 1; j <= n; j++) {
      if (x[j] + s[j] > i) {
        if (x[j] - s[j] <= i) f[i] = f[i - 1];
        continue;
      }
      f[i] = min(f[i], f[max(1, x[j] - s[j] - max(0, -x[j] - s[j] + i)) - 1] +
                           max(0, -x[j] - s[j] + i));
    }
  }
  printf("%d\n", f[m]);
  return 0;
}
