#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);
    /*kupovina[0].d=0;
    kupovina[0].p=0;
    */
    for (int i=0; i<n; i++)
    {
        cin>> kupovina[i].d>>kupovina[i].p;
    }

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


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

    for (int i=0; i<q; i++)
    {
        x=k[i];
        if (kupovina[0].d>x)
        {
            a[i]=0;
        }
        else
        {
            while (l<n-1 && kupovina[l+1].d<=x)
            {
                
                if (l==0)
                {
                    h=min(kupovina[l+1].d-kupovina[l].d, kupovina[l].p);
                }
                else
                {
                    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=0; i<q; i++)
    {
        cout<< a[i]<< endl;
    }
    
    return 0;
}