#include <iostream>
#include <bits/stdc++.h>
#include <vector>
#include <set>
#include <math.h>
#include <string.h>
#include <cstdlib>
#include <sstream>
#include <algorithm>
#include <stack>
#include <queue>
#include <deque>
#include <bitset> 
#include <fstream>

typedef long long ll;

#define INF 10000000;
 
using namespace std;

vector<int> insertVector(int n)
{
    vector<int> x;
    for(ll i = 0; i < n; i++)
    {
        int y;
        cin >> y;
        x.push_back(y);
    }

    return x;
}

void displayVector(vector<int> x)
{
    for(auto i : x)
        cout << i << " ";

    cout << "\n";    
}


int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    ll n, k;
    double ans = 0;
    cin >> n >> k;
    vector<pair<ll,ll>> x;
    for(ll i = 0; i < n; i++)
    {
        ll y, z;
        cin >> y >> z;
        x.push_back(make_pair(y, z));
    }

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

    /*for(auto i : x)
    {
        cout << i.first <<  " " << i.second << endl;
    }*/
    
    for(ll i = 0; i < n; i++)
    {
        if(x[i].first == x[i - 1].first)
        {
            k = k + x[i].second;
        }
        
        else if((ans + k) - x[i].first < 0)
        {
            ans = ans + k;
            k = 0;
            break;
        }

        else
        {
            k = (ans + k) - x[i].first + x[i].second;
            ans = x[i].first;
        }
         
    }

    if(k > 0)
        ans = ans + k;

    cout << setprecision(100) << ans;     
    
}      

   


#include<bits/stdc++.h>
#define rep(i, m, n) for(int i = m; i < (int)(n); i++)
#define _GLIBCXX_DEBUG
using namespace std;
using ll = long long;

int main() {
    ll n, k;
    cin >> n >> k;
    vector<pair<ll, ll>> ab(n);
    rep(i, 0, n) cin >> ab[i].first >> ab[i].second;
    sort(ab.begin(), ab.end());
    rep(i, 1, n) {
        if(ab[i].first == ab[i - 1].first) {
            ab[i].second += ab[i - 1].second;
            ab[i - 1].first = 0;
            ab[i - 1].second = 0;
        }
    }

    ll ans = 0;
    rep(i, 0, n) {
        if((ans + k) - ab[i].first < 0) {
            ans += k;
            break;
        }
        k -= (ab[i].first - ans);
        k += ab[i].second;
        ans += (ab[i].first - ans);

        if(i == n - 1) ans += k;
    }

    cout << ans << endl;
}