#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mp make_pair
#define pb push_back
#define F first
#define S second
#define debug(x) std::cout << #x << ": " << x << "\n"
#define all(v) v.begin(), v.end()
#define li(i,a,b) for (int (i) = (a); (i) < (b); (i)++)
#define endl '\n'
#define mem(name,val) memset(name,val,sizeof(name))
#define min(a,b) (a<=b ? a : b)
#define max(a,b) (a>=b ? a : b)
//using u64 = uint64_t;
//using u128 = __uint128_t;

int main()
{
    ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);    
    int n, q;
    cin>>n>>q;
    vector<ll> d(n), p(n), poj(n); // 0<poj[i]<1e18 
    vector<ll> ost_ceo(n), ost_mod(n); // 0 < ost[i] < n * 1e18; mod = 1e18+1
 
    li(i,0,n){
        cin>>d[i]>>p[i];
    }

    ost_ceo[0] = 0;
    ost_mod[0] = p[0]-1;
    poj[0] = 1;

    li(i,1,n){
        if(ost_ceo[i-1]){
            poj[i] = poj[i-1] + d[i] - d[i-1]; 
        }
        else{
            poj[i] = poj[i-1] + min(ost_mod[i-1] + 1, d[i] - d[i-1]);     
        }


        ll delta = ost_mod[i-1] + p[i] - (poj[i]-poj[i-1]);
        
        if(delta < 0){
            ost_ceo[i] = ost_ceo[i-1] - 1;
            ost_mod[i] = 1e18+1 + delta;
        }
        else{
            ost_ceo[i] = ost_ceo[i-1];
            ost_mod[i] = delta;
        }
    }

    ll k;
    li(_,0,q){
        cin>>k;
        int ind = upper_bound(all(d), k) - d.begin();
        
        if(ind == 0){
            cout<<0<<endl;
        }
        else{
            if(ost_ceo[ind-1]){
                cout<<poj[ind-1] + k - d[ind-1]<<endl;
            }
            else{
                cout<<poj[ind-1] + min(ost_mod[ind-1], k - d[ind-1])<<endl;
            }
        }
    }

    return 0;
}