#include <bits/stdc++.h>
const int NMAX = 1005;
using namespace std;
int N, S;
int t, f;
int crt_time;
int latest[NMAX];
int main() {
  cin >> N >> S;
  crt_time = 0;
  for (int i = 1; i <= N; ++i) {
    cin >> f >> t;
    latest[f] = max(latest[f], t);
  }
  for (int i = S; i >= 0; --i) {
    if (latest[i] > crt_time) {
      crt_time = latest[i];
    }
    crt_time++;
  }
  crt_time--;
  cout << crt_time;
  return 0;
}
