#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, s;
  cin >> n >> s;
  int *sa = new int[s + 1];
  for (int i = 0; i < s + 1; i++) {
    sa[i] = 0;
  }
  for (int i = 0; i < n; i++) {
    int tm, tp;
    cin >> tm >> tp;
    if (sa[tm] < tp) {
      sa[tm] = tp;
    }
  }
  int t = 0;
  for (int i = s; i > 0; i--) {
    if (t < sa[i]) t = sa[i];
    t++;
  }
  cout << t << endl;
  getchar();
  getchar();
  return 0;
}
