#include <bits/stdc++.h>

using namespace std;

#define ll long long
const int INF=1e9;
const ll LINF=1e18,MOD=1e9+7;
#define fi first
#define se second
#define pii pair<int,int>
#define mid ((l+r)/2)
#define sz(a) (int((a).size()))
#define all(a) a.begin(),a.end()
//#define endl "\n"
#define pb push_back

void PRINT(int x) {cerr << x;}
void PRINT(ll x) {cerr << x;}
void PRINT(double x) {cerr << x;}
void PRINT(char x) {cerr << '\'' << x << '\'';}
void PRINT(string x) {cerr << '\"' << x << '\"';}
void PRINT(bool x) {cerr << (x ? "true" : "false");}

template<typename T,typename V>
void PRINT(pair<T,V>& x){
    cerr<<"{";
    PRINT(x.fi);
    cerr<<",";
    PRINT(x.se);
    cerr<<"}";
}
template<typename T>
void PRINT(T &x){
    int id=0;
    cerr<<"{";
    for(auto _i:x){
        cerr<<(id++ ? "," : "");
        PRINT(_i);
    }
    cerr<<"}";
}
void _PRINT(){
    cerr<<"]\n";
}
template<typename Head,typename... Tail>
void _PRINT(Head h,Tail... t){
    PRINT(h);
    if(sizeof...(t)) cerr<<", ";
    _PRINT(t...);
}

#define Debug(x...) cerr<<"["<<#x<<"]=["; _PRINT(x)

void Solve(){
    int n,q; cin>>n>>q;
    vector<ll> D(n+1),P(n+1);
    vector<ll> Q(q+1);
    for(int i=1;i<=n;i++){
        cin>>D[i]>>P[i];
    }
    for(int i=1;i<=q;i++){
        cin>>Q[i];
    }
    vector<ll> ans(q+1);
    ll br_plazmi=0;
    ll l=0,r=-1;
    int i=0;
    for(int j=1;j<=q;j++){
        while(i<n && D[i+1]<=Q[j]){
            if(l==0 && r==0){
                l=D[i+1];
                r=l+P[i+1]-1;
            }
            else if(r>=D[i+1]-1){
                r+=P[i+1];
            }
            else{
                br_plazmi+=r-l+1;
                l=D[i+1];
                r=l+P[i+1]-1;
            }
            i++;
        }

        ll res=0;
        res+=br_plazmi;
        if(r>=Q[j]){
            res+=Q[j]-l+1;
        }
        else{
            res+=r-l+1;
        }
        ans[j]=res;
    }
    for(int i=1;i<=q;i++){
        cout<<ans[i]<<endl;
    }
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int t; t=1;
    while(t--){
        Solve();
    }
    return 0;
}