#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define forp(i,a,b) for(ll i=a;i<=b;i++)
#define forn(i,a,b) for(ll i=a;i>=b;i--)
#define read(a,n) forp(i,1,n){cin>>a[i];}
#define vi vector<ll>
#define newl '\n'
#define mod 1000000007
#define no cout<<"NO"<<newl; return;
#define yes cout<<"YES"<<newl; return;
#define imp cout<<"-1"<<newl; return;

void solve(){
    ll n,k; cin>>n>>k;
    map<ll,ll> m; ll x,y;
    forp(i,1,n){
        cin>>x>>y;
        m[x]+=y;
    }
    ll ans=0,aa;
    for(auto it=m.begin(); it!=m.end(); it++){
        //cout<<it->first<<" "<<ans<<" "<<k<<newl;
        if(ans+k<(it->first)){
            cout<<ans+k<<newl; return;
        } else {
            k-=(it->first - ans);
            k+=(it->second);
            ans=(it->first);
        }
        aa=it->first;
    }
    cout<<aa+k<<newl;
}

int main() {
    clock_t start,end;
    start=clock();
    ios_base::sync_with_stdio(false); 
    cin.tie(NULL); 
    cout.tie(NULL);
    #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
    ll t=1;
    //cin>>t;
    while(t--){
        solve();
    }
    end=clock();
    //cout<<newl<<"Time : "<<double(end - start)/double(CLOCKS_PER_SEC)<<newl;
}
#pragma GCC optimize("Ofast")
#define _CRT_SECURE_NO_WARNINGS
#include "bits/stdc++.h"

using namespace std;

#define int long long
#define pb push_back
#define all(v) v.begin(),v.end()
#define allr(v) v.rbegin(),v.rend()
#define mod (int)(1e9+7)
#define mod2 998244353
#define PI 3.1415926535897932384626433832795

void solve() {
    int n,q; cin>>n>>q;
    int a[n];
    for(auto &it:a)
        cin>>it;
    set<int> s;
    // int mxn=*max_element(a,a+n);

    // for(int i=1;i<=1e6;i++){
    //     s.insert(i);
    // }
    // for(int i=0;i<n;i++){
    //     s.erase(a[i]);
    // }
    // vector<int> v(all(s));
    sort(a,a+n);
    // s.clear();
    int p[n];
    p[0]=a[0]-1;
    for(int i=1;i<n;i++){
        p[i]=p[i-1];
        p[i]+=(a[i]-a[i-1]-1);
    }
    while(q--){
        int x; cin>>x;
        // if(x<=(int)v.size()){
        //     cout<<v[x-1]<<' ';//continue;
        // }
        int ind=lower_bound(p,p+n,x)-p;
        if(ind<n){
            int diff=p[ind]-x+1;
            cout<<a[ind]-diff<<'\n';
        } else {
            int diff=x-p[n-1];
            cout<<a[n-1]+diff<<'\n';
        }
    }
}

int32_t main() {
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t=1;
    // cin>>t;
    while(t--){
        solve();
    }
    return 0;
}
