#include <bits/stdc++.h>
const long double eps = 1e-10;
const int mod = 10;
using namespace std;
const int N = 12345;
int n, s, a, b;
int f[N];
int main() {
  cin >> n >> s;
  for (int i = 0; i < n; ++i) {
    cin >> a >> b;
    f[a] = max(f[a], b);
  }
  int time = 0;
  for (int i = s; i >= 1; --i) {
    if (time < f[i]) {
      time += f[i] - time;
    }
    time++;
  }
  cout << time << endl;
}
