#include <iostream>
#include <vector>

using namespace std;


struct Plazma 
{
    unsigned long long d, p;
};

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int n, q;
    cin>> n >> q;
    vector <Plazma> kupovina(n+1);
    kupovina[0].d=0;
    kupovina[0].p=0;

    for (int i=1; i<=n; i++)
    {
        cin>> kupovina[i].d>>kupovina[i].p;
    }

    vector <unsigned long long> k(q+1);
    k[0]=0;
    for (int i=1; i<=q; i++)
    {
        cin>> k[i];
    }


    unsigned long long a[q], x=0, l=1, s=kupovina[1].p;
    long long h=0, j=0, d;

    for (int i=1; i<=q; i++)
    {
        x=k[i];
        if (kupovina[1].d>x)
        {
            a[i]=0;
        }
        else
        {
                while (l<n && kupovina[l+1].d<=x)
                {
                    h=h+min(kupovina[l+1].d-kupovina[l].d, kupovina[l].p+kupovina[l-1].p-h);
                    l++;
                    s=s+kupovina[l].p;
                }
                a[i]=h+min(x-kupovina[l].d+1, s-h);
            
        }
    }

    
    for (int i=1; i<=q; i++)
    {
        cout<< a[i]<< endl;
    }
    
    return 0;
}