#include<bits/stdc++.h>
#define ll long long
#define MAXN 300007
using namespace std;
ll d[MAXN], p[MAXN];
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    int n, q;
    cin>>n>>q;
    for(int i=0;i<n;i++)
    {
        cin>>d[i]>>p[i];
    }
    for(int i=0;i<n-1;i++)
    {
        if(d[i+1]-d[i]<p[i])
        {
            p[i+1]+=p[i]-(d[i+1]-d[i]);
            p[i]=d[i+1]-d[i];
        }
    }
    int i=0;
    ll ans=0;
    while(q--)
    {
        ll k;
        cin>>k;
        while(i<n-1 && d[i+1]<=k)
        {
            ans+=p[i];
            i++;
        }
        cout<<ans+min(p[i],max(k-d[i]+1ll,0ll))<<endl;
    }
}