#include <bits/stdc++.h>
#define endl '\n'
using namespace std;

int main()
{
ios::sync_with_stdio(0);cin.tie(0);
long long n,q,brojpk=0,brojk=0,ii=0;
cin>>n>>q;
vector<long long>d(n);
vector<long long>p(n);
vector<long long>k(n);
for(long long i=0;i<n;i++)
{
    cin>>d[i]>>p[i];
}
for(long long i=0;i<q;i++)
{
    cin>>k[i];
}
for(long long j=0;j<q;j++)
{
    for(long long i=ii;d[i+1]<k[j] && i+1<n;i++)
    {
        brojk+=p[i];
        brojpk+=min(brojk,d[i+1]-d[i]);
        brojk-=min(brojk,d[i+1]-d[i]);
        ii++;
    }
    cout<<brojpk+max(min(brojk+p[ii],k[j]-d[ii]+1),0LL)<<endl;
}

    return 0;
}