#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n, s;
  cin >> n >> s;
  vector<int> floorMaxTime(s + 1, 0);
  int floor, time;
  for (int i = 0; i < n; i++) {
    cin >> floor >> time;
    floorMaxTime[floor] = max(floorMaxTime[floor], time);
  }
  int totalSecond = 0;
  while (s > 0) {
    if (totalSecond < floorMaxTime[s]) {
      totalSecond += (floorMaxTime[s] - totalSecond);
    }
    totalSecond++;
    s--;
  }
  cout << totalSecond;
  return 0;
}
