#include <bits/stdc++.h>
using namespace std;
int H[200666];
int main() {
  int n, level, i;
  cin >> n >> level;
  for (i = 1; i <= n; ++i) {
    int pp, tt;
    cin >> pp >> tt;
    H[pp] = max(H[pp], tt);
  }
  int time = 0;
  for (; level; --level) {
    time = max(time, H[level]);
    ++time;
  }
  cout << time << '\n';
  return 0;
}
