#include <bits/stdc++.h>
using namespace std;
void insertionSort(int arr[], int arr2[], int n) {
  int j = 0, k, l;
  for (int i = 1; i < n; i++) {
    k = arr[i];
    l = arr2[i];
    j = i - 1;
    while (j >= 0 && arr[j] > k) {
      arr[j + 1] = arr[j];
      arr2[j + 1] = arr2[j];
      j--;
    }
    arr[j + 1] = k;
    arr2[j + 1] = l;
  }
}
int main() {
  int n, s, all = 0, time = 0;
  cin >> n >> s;
  int* flo = new int[n];
  int* ti = new int[n];
  for (int i = 0; i < n; i++) {
    cin >> flo[i] >> ti[i];
  }
  insertionSort(flo, ti, n);
  for (int i = n - 1; i >= 0; i--) {
    all += (s - flo[i]);
    time += (s - flo[i]);
    if (time < ti[i]) {
      all += (ti[i] - time);
      time = ti[i];
    }
    s = flo[i];
  }
  all += (s);
  cout << all << endl;
  return 0;
}
