#include <bits/stdc++.h>
using namespace std;
void bsort(int* m, int* s, int n) {
  int counter = 1;
  while (counter) {
    counter = 0;
    int i;
    for (i = 0; i < n - 1; i++) {
      if (m[i] < m[i + 1]) {
        counter += 1;
        int tempm = m[i];
        int temps = s[i];
        m[i] = m[i + 1];
        s[i] = s[i + 1];
        m[i + 1] = tempm;
        s[i + 1] = temps;
      }
    }
  }
}
int main() {
  int n, s;
  cin >> n >> s;
  int* floor = new int[n];
  int* time = new int[n];
  for (int i = 0; i < n; i++) {
    cin >> floor[i] >> time[i];
  }
  bsort(floor, time, n);
  int timesofar = 0;
  int curfloor = s;
  for (int i = 0; i < n; i++) {
    int a = time[i];
    int b = timesofar + (curfloor - floor[i]);
    if (a > b)
      timesofar = a;
    else
      timesofar = b;
    curfloor = floor[i];
  }
  if (curfloor > 0) timesofar += curfloor;
  cout << timesofar;
  cout << '\n';
}
