#include <bits/stdc++.h>
using namespace std;
void FastIO() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  cout.precision(15);
}
int main() {
  FastIO();
  int n, s, f, t, time, i, j;
  vector<pair<int, int> > v;
  cin >> n >> s;
  for (i = 0; i < n; i++) {
    cin >> f >> t;
    v.push_back(make_pair(f, t));
  }
  time = 0;
  for (i = s; i >= 1; i--) {
    for (j = 0; j < n; j++) {
      if (v[j].first == i) {
        time = ((time < v[j].second) ? v[j].second : time);
      }
    }
    time = time + 1;
  }
  cout << time << "\n";
  return 0;
}
