#include <bits/stdc++.h>
using namespace std;
int n, m, x[100], s[100], dp[100100];
int main() {
  ios_base::sync_with_stdio(false);
  cin >> n >> m;
  for (int i = 1; i <= m; i++) dp[i] = i;
  for (int i = 1; i <= n; i++) cin >> x[i] >> s[i];
  for (int i = 1; i <= m; i++) {
    for (int j = 1; j <= n; j++) {
      if (i >= x[j]) {
        if (i <= x[j] + s[j])
          dp[i] = min(dp[i], dp[max(0, x[j] - s[j] - 1)]);
        else
          dp[i] = min(dp[i], dp[max(0, x[j] - s[j] - 1 - (i - (x[j] + s[j])))] +
                                 i - (x[j] + s[j]));
      } else {
        dp[i] = min(dp[i], dp[max(0, x[j] - s[j] - 1)]);
      }
    }
  }
  cout << dp[m] << endl;
  return 0;
}
