#include<bits/stdc++.h>
#define int long long
using namespace std;
signed main(){
    int n,q;
    cin>>n>>q;
    vector<int>a(n);
    vector<int>izs(n);
    vector<int>dp(n);
    for (int i=0;i<n;++i){
        cin>>a[i];
        int p;
        cin>>p;
        if(i>0){
            dp[i]=max(a[i]-1,dp[i-1])+p;
            izs[i]=izs[i-1]+min(dp[i-1]-a[i]+1,0ll);
        }
        else{
            dp[i]=max(a[i]-1,0ll)+p;
            izs[i]=min(1-a[i],0ll);
        }
    }
    while(q--){
        int k;
        cin>>k;
        auto it=upper_bound(a.begin(),a.end(),k);
        int id=it-a.begin();
        --id;
        if(id==-1){
            cout<<0<<'\n';
            continue;
        }
        if(it==a.end())
            id=n-1;
        cout<<izs[id]+min(k,dp[id])<<'\n';
    }
    return 0;
}