#include <bits/stdc++.h>
using namespace std;
const int N = 4e5 + 5;
int n, m, dp[105][N];
pair<int, int> p[105];
int solve(int idx, int last) {
  if (idx == n) {
    if (last >= m) return 0;
    return m - last;
  }
  if (dp[idx][last] != -1) return dp[idx][last];
  if (last >= p[idx].first - p[idx].second - 1) {
    int new_last = max(last, p[idx].first + p[idx].second);
    return dp[idx][last] = solve(idx + 1, new_last);
  }
  int op1 = solve(idx + 1, last);
  int cost = p[idx].first - p[idx].second - last - 1;
  int op2 = solve(idx + 1, p[idx].first + p[idx].second + cost) + cost;
  return dp[idx][last] = min(op1, op2);
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m;
  for (int i = 0; i < n; i++) cin >> p[i].first >> p[i].second;
  sort(p, p + n);
  memset(dp, -1, sizeof dp);
  cout << solve(0, 0);
  return 0;
}
