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

int main(){

    int n,k;
    cin >> n >> k;
    vector<pair<unsigned long long int,unsigned long long int>> f(n);
    for(int i=0; i<n; i++){
        cin >> f[i].first >> f[i].second;
    }
    sort(f.begin(),f.end());


    unsigned long long int money = k;
    unsigned long long int cur = 0;
    for(int i=0; i<n; i++){
        unsigned long long int tmp = f[i].first - cur;
        if(tmp<=money){
            money -= tmp;
            money += f[i].second;
            cur = f[i].first;
        }else{
            break;
        }
    }

    unsigned long long int ans = cur + money;
    cout << ans << endl;




}
#include<bits/stdc++.h>

using namespace std;

#define LL           long long
#define ULL          long long unsigned
#define LD           long double
#define ff              first
#define ss              second
#define FOR(i,n)     for(int i=0;i<n;i++)
#define FLR(i,n)     for(LL i=0;i<n;i++)
#define RFOR(i,n)    for(int i=n-1;i>=0;i--)
#define RFLR(i,n)    for(LL i=n-1;i>=0;i--)
#define rep(i,a,b)   for(int i=a;i<=b;i++)
#define repl(i,a,b)  for(LL i=a;i<=b;i++)
#define fast         ios_base::sync_with_stdio(0);cin.tie(0);
#define all(a)       a.begin(),a.end()
#define ABS(x)       ((x)<0?-(x):(x))
#define NL           "\n"
#define pb           push_back
#define mk              make_pair
#define pi           acos(-1.0)
#define prec(n)      fixed << setprecision(n)
#define sq(a)          (a)*(a)


int main()
{
    fast;
    LL i,j,k,a,b,n,ans=0,prev=0,sum=0;
    map<LL,LL>mp;
    cin>>n>>k;
    //ans=k;
    FOR(i,n){
        cin>>a>>b;
        mp[a]+=b;
    }
    sum+=k;
    for(auto it:mp){
        if(it.ff<=sum){
            k-=(it.ff-prev);
            k+=it.ss;
            prev=it.ff;
            sum+=it.ss;
        }
        else {
            ans=prev+k;
            //cout<<sum<<endl;
            //cout<<ans;
            //return 0;
            break;
        }
    }
    ans=prev+k;
    cout<<sum;



}
