#include <bits/stdc++.h>
#define pb push_back
#define popb pop_back
#define fi first
#define se second
#define ull unsigned ll
#define pll pair<ll,ll>
#define ll long long
#define INF 1e18
#define mod 998244353
#define maxn 300010
#define logN 17
using namespace std;

ll t[maxn],k[maxn],p[maxn],te[maxn];

int main(){
    ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); cerr.tie(0);
    ll n,q; cin>>n>>q;
    for(ll i=1;i<=n;i++){
        cin>>t[i]>>k[i];
        p[i]=p[i-1]+k[i];
        te[i]=max(te[i-1],t[i])+k[i];
    }
    ll ind=1;
    for(ll i=1;i<=q;i++){
        ll pom; cin>>pom;
        while(te[ind]<pom && ind<n) ind++;
        cout<<max(0LL,p[ind]+min(0LL,pom-te[ind]+1))<<"\n";
    }
    return 0;
}