#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;

//template
#define rep(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define ALL(v) (v).begin(),(v).end()
using ll=long long int;
const int inf = 0x3fffffff; const ll INF = 0x1fffffffffffffff; const double eps=1e-12;
template<typename T>inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<typename T>inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
//end



int main(){
   int n,k;
   cin>>n>>k;
   using P=pair<ll,ll>;
   vector<P> ps(n);
   rep(i,0,n)cin>>ps[i].first>>ps[i].second;
   sort(ALL(ps));
   vector<ll> a(n+1),b(n+1);
   rep(i,1,n+1){
      a[i]=ps[i-1].first;
      b[i]=ps[i-1].second;
   }
   ll cur=k;
   rep(i,1,n+1){
      if(cur<a[i]-a[i-1]){
         cout<<cur+a[i-1]<<'\n';
         return 0;
      }
      else{
         cur-=a[i]-a[i-1];
         cur+=b[i];
      }
   }
   cout<<cur+a.back()<<'\n';
   return 0;
}
#include"bits/stdc++.h"
using namespace std;
typedef long long ll;

int main(){
    ll n,k;
    cin>>n>>k;

    vector<pair<ll,ll>>a(n);

    for(ll i=0;i<n;i++)cin>>a[i].first>>a[i].second;

    sort(a.begin(),a.end());

    ll now=0;

    for(ll i=0;i<n;i++){
        if(k-(a[i].first-now)<0){
            cout<<now+k<<endl;
            return 0;
        }

        k-=(a[i].first-now);
        k+=a[i].second;
        now=a[i].first;
    }

    cout<<now+k<<endl;
}