#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, s, f[100], t[100];
  cin >> n >> s;
  for (int i = 0; i < n; i++) {
    cin >> f[i] >> t[i];
    f[i] = f[i] + t[i] - s;
  }
  int ans = s;
  for (int i = 0; i < n; i++)
    if (f[i] > 0)
      for (int j = i + 1; j < n; j++) f[j] -= f[i];
  for (int i = 0; i < n; i++)
    if (f[i] > 0) ans += f[i];
  cout << ans << endl;
}
