#include <bits/stdc++.h>
using namespace std;
void merge(int a[], int b[], int l, int r, int mid) {
  int i, j, k;
  int m, n;
  m = mid - l + 1;
  n = r - mid;
  int left[m], right[n], l1[m], r1[n];
  i = 0;
  j = l;
  while (i <= m) {
    left[i] = a[j];
    l1[i] = b[j];
    j++;
    i++;
  }
  i = 0, j = mid + 1;
  while (i <= n) {
    right[i] = a[j];
    r1[i] = b[j];
    j++;
    i++;
  }
  k = l, i = 0, j = 0;
  while (i < m && j < n) {
    if (left[i] > right[j]) {
      a[k] = left[i];
      b[k] = l1[i];
      i++;
    } else {
      a[k] = right[j];
      b[k] = r1[j];
      j++;
    }
    k++;
  }
  while (i < m) {
    a[k] = left[i];
    b[k] = l1[i];
    i++;
    k++;
  }
  while (j < n) {
    a[k] = right[j];
    b[k] = r1[j];
    k++;
    j++;
  }
}
void mergesort(int a[], int b[], int l, int r) {
  if (r > l) {
    int mid = (l + r) / 2;
    mergesort(a, b, l, mid);
    mergesort(a, b, mid + 1, r);
    merge(a, b, l, r, mid);
  }
}
int main() {
  int n, s, i;
  cin >> n >> s;
  int t = 0, last = s;
  int x[n], y[n];
  for (i = 0; i < n; i++) {
    cin >> x[i] >> y[i];
  }
  mergesort(x, y, 0, n - 1);
  for (i = 0; i < n; i++) {
    t = t + s - x[i];
    s = x[i];
    if (y[i] > t) t = y[i];
  }
  t = t + s;
  cout << t;
  return 0;
}
