#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
int dp[100005], x[105], s[105];
bool vis[100005];
int main() {
  int n, m, minv = INF;
  scanf("%d%d", &n, &m);
  for (int i = 0; i < n; ++i) {
    scanf("%d%d", &x[i], &s[i]);
    minv = min(minv, x[i]);
    for (int j = max(x[i] - s[i], 1); j <= min(x[i] + s[i], m); ++j) {
      vis[j] = true;
    }
  }
  memset(dp, INF, sizeof(dp));
  dp[0] = 0;
  for (int i = 1; i <= m; ++i) {
    if (vis[i])
      dp[i] = min(dp[i - 1], dp[i]);
    else {
      if (i >= minv) dp[i] = min(dp[i], dp[i - 1] + 1);
      for (int j = 0; j < n; ++j) {
        if (x[j] > i) {
          int tem = x[j] - s[j] - i;
          dp[min(m, x[j] + s[j] + tem)] =
              min(dp[min(x[j] + s[j] + tem, m)], dp[i - 1] + tem);
        }
      }
    }
  }
  printf("%d\n", dp[m]);
  return 0;
}
