#include <bits/stdc++.h>
using namespace std;
void rec(int a[][2], int st, int ed, int mid) {
  int i = st, j = mid + 1, c = 0, b[ed - st + 1][2];
  while (i <= mid && j <= ed) {
    if (a[i][0] > a[j][0]) {
      b[c][0] = a[i][0];
      b[c++][1] = a[i++][1];
    } else {
      b[c][0] = a[j][0];
      b[c++][1] = a[j++][1];
    }
  }
  while (i <= mid) {
    b[c][0] = a[i][0];
    b[c++][1] = a[i++][1];
  }
  while (j <= ed) {
    b[c][0] = a[j][0];
    b[c++][1] = a[j++][1];
  }
  c--;
  while (c >= 0) {
    a[ed][1] = b[c][1];
    a[ed--][0] = b[c--][0];
  }
}
void mer(int a[][2], int st, int ed) {
  int c = (st + ed) / 2;
  if (st != c) {
    mer(a, st, c);
    mer(a, c + 1, ed);
    rec(a, st, ed, c);
  } else if (a[st][0] < a[ed][0]) {
    int temp = a[st][0];
    a[st][0] = a[ed][0];
    a[ed][0] = temp;
    temp = a[st][1];
    a[st][1] = a[ed][1];
    a[ed][1] = temp;
  }
}
int main() {
  int m, n, i, j, c, p = 0;
  cin >> m >> n;
  c = n;
  int a[m][2];
  for (i = 0; i < m; i++) {
    for (j = 0; j < 2; j++) cin >> a[i][j];
  }
  mer(a, 0, m - 1);
  i = 0;
  while (1) {
    p = p + c - a[i][0];
    c = a[i][0];
    if (a[i][1] > p) p = a[i][1];
    if (i == m - 1) break;
    i++;
  }
  cout << p + a[i][0] << endl;
  return 0;
}
