#include <bits/stdc++.h>
using namespace std;
template <typename... Ts>
void _dbg(const char* s, Ts... ts) {
  auto run = [&s]() {
    for (int b = 0; *s && ((b += (*s == '(') - (*s == ')')) != 0 || *s != ',');
         cerr << *s++)
      ;
  };
  ((run(), cerr << " = " << forward<Ts>(ts) << ",\n"[*s++ == '\0']), ...);
}
const int N = 200 * 1000 + 17;
const int MOD = 1000 * 1000 * 1000 + 7;
int n, m;
pair<int, int> p[N];
int dp[81][N];
bool read() {
  if (!(cin >> n >> m)) return false;
  for (int i = 1; i <= n; ++i) cin >> p[i].first >> p[i].second;
  return true;
}
void solve() {
  sort(p + 1, p + n + 1);
  for (int j = 0; j <= m; ++j) dp[0][j] = MOD;
  dp[0][0] = 0;
  for (int i = 1; i <= n; ++i) {
    int x = p[i].first;
    int s = p[i].second;
    for (int j = 0; j <= m; ++j) dp[i][j] = MOD;
    for (int d = 0; x - s - d >= 0 || x + s + d <= m; ++d) {
      int l = max(1, x - s - d);
      int r = min(m, x + s + d);
      dp[i][r] = min(dp[i][r], d + dp[i - 1][l - 1]);
    }
    dp[i][m + 1] = MOD;
    for (int j = m; j >= 0; --j)
      dp[i][j] = min({dp[i][j], dp[i - 1][j], dp[i][j + 1]});
  }
  cout << dp[n][m] << '\n';
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  while (read()) solve();
  return 0;
}
