#include <bits/stdc++.h>
using namespace std;
long long int inline ipow(long long int a, long long int b, long long int m) {
  long long int val = 1;
  a %= m;
  while (b) {
    if (b & 01) val = (val * a) % m;
    b >>= 1;
    a = (a * a) % m;
  };
  return val % m;
}
long long int inline ipow(long long int a, long long int b) {
  long long int val = 1;
  while (b) {
    if (b & 01) val = (val * a);
    b >>= 1;
    a = (a * a);
  };
  return val;
}
int main() {
  std::ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  clock_t tStart = clock();
  int n, x, y, ans = 0, cur, s;
  vector<pair<int, int> > a;
  cin >> n >> s;
  for (int i = 1; i <= n; i++) {
    cin >> x >> y;
    a.push_back(make_pair(x, y));
  }
  sort(a.begin(), a.end());
  reverse(a.begin(), a.end());
  cur = s;
  for (int i = 0; i < n; i++) {
    ans += max(cur - a[i].first, a[i].second - ans);
    cur = a[i].first;
  }
  ans += cur;
  cout << ans << endl;
  return 0;
}
