#include <bits/stdc++.h>
using namespace std;
#define int long long
#define endl '\n'
signed main()
{
ios::sync_with_stdio(0);cin.tie(0);
int n,q;
cin>>n>>q;
vector<int>d(n);
vector<int>p(n);
for(int i = 0 ;i<n;i++){
    cin>>d[i]>>p[i];
}
vector<int>poc(n);
vector<int>kraj(n);
poc[0]=d[0];
kraj[0]=poc[0]+p[0];
for(int i = 1 ;i<n;i++){
poc[i]=max(d[i],kraj[i-1]);
kraj[i]=poc[i]+p[i];

}

vector<int>pref(n);
pref[0]=p[0];
for(int i = 1;i<n;i++)
    pref[i]=pref[i-1]+p[i];
int help=0;
for(int j=0;j<q;j++){
int x;
cin>>x;
    for(int  i = help;i<=n;i++){
        if(i==n){
            cout<<pref[n-1]<<endl;
            break;
        }

        if(kraj[i]>x&&i>0){
            help=i;
            if(x-poc[i]+1>0)
            cout<<pref[i-1]+(x-poc[i])+1<<endl;
            else
            cout<<pref[i-1]<<endl;
            break;
        }
        if(kraj[i]>x&&i==0){
            if(x-poc[i]+1>0)
            cout<<x-poc[i]+1<<endl;
            else
            cout<<0<<endl;
            break;
        }



    }

}

return 0;
}