#include <bits/stdc++.h>
using namespace std;
long long int factors(long long int ans) {
  long long int count = 0;
  for (int i = 1; i <= sqrt(ans); i++) {
    if (ans % i == 0) {
      if (ans / i == i) {
        count++;
      } else {
        count = count + 2;
      }
    }
  }
  return count;
}
long long int GCD(long long int a, long long int b) {
  if (b == 0) return a;
  return GCD(b, a % b);
}
int main() {
  ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  srand(time(NULL));
  vector<pair<int, int> > v;
  int n, s;
  cin >> n >> s;
  int f = s;
  int t = 0;
  for (int i = 0; i < n; i++) {
    int x, y;
    cin >> x >> y;
    v.push_back({x, y});
  }
  sort(v.begin(), v.end());
  for (int i = v.size() - 1; i >= 0; i--) {
    if (f != v[i].first) {
      t = t + (f - v[i].first);
      f = v[i].first;
    }
    if (v[i].second > t) {
      t = t + (v[i].second - t);
    }
  }
  t = t + f;
  cout << t << endl;
  return 0;
}
