#include <iostream>
#include <math.h>

using namespace std;

int main()
{
    int n, q, x;
    int* px=&x;
    unsigned long long s=0;
    cin>>n>>q;
    int l=0, r=n-1;
    unsigned long long D[n], K[q], S[n];
    unsigned int P[n];
    cin>>D[0]>>P[0];
    S[0]=P[0];
    for(int i=1;i<n;i++)
    {
        cin>>D[i]>>P[i];
        if(D[i-1]+P[i-1]>D[i])
        {
            D[i]=D[i-1]+P[i-1];
        }
        S[i]=S[i-1]+P[i];
    }
    for(int i=0;i<q;i++)
    {
        cin>>K[i];
        r=n-1;
        while(r-l>1)
        {
            if(K[i]<(D[l]+D[r]+P[r])/2)
            {
                r=ceil((float)(l+r)/2);
            }
            else if(K[i]>(D[l]+D[r]+P[r])/2)
            {
                l=floor((float)(l+r)/2);
            }
        }
        if(K[i]<D[l])
            cout<<0<<"\n";
        else if(K[i]<D[l]+P[l])
            cout<<1+S[l]-(P[l]-(K[i]-D[l]))<<"\n";
        else if(K[i]<D[r])
            cout<<S[l]<<"\n";
        else if(K[i]<D[r]+P[r])
            cout<<1+S[r]-(P[r]-(K[i]-D[r]))<<"\n";
        else
            cout<<S[r]<<"\n";
    }
    return 0;
}