#include <iostream>

using namespace std;

int main()
{
    int n, q;
    long long int d[300050], p[300050], k[300050];
    cin >> n >> q;
    for(int i = 0; i<n; i++)
    {
        cin >> d[i] >> p[i];
    }
    for(int i = 0; i<q; i++)
    {
        cin >> k[i];
    }
    int c1 = 0;
    long long int kol = 0, poj=0, brD, o=0;
    bool r = false;
    for(int i=0; i<q; i++)
    {
        while(k[i]<d[0])
        {
            cout << 0 << endl;
            i++;
        }

        for(int j = c1; j<n; j++)
        {
            while((d[j] <= k[i] && d[j+1] > k[i]))
            {
                cout << poj+min(kol+p[j],(k[i]-d[j]+1)) << endl;
                i++;
                r = true;
            }
            if(j<n-1)
            {
                brD = d[j+1]-d[j];
                kol += p[j];
                poj += min(kol, brD);
                kol -= min(kol, brD);
            }
            else
            {
                kol += p[j];
                break;
            }
            if(r)
            {
                c1 = j+1;
                r = false;
                if(i == q-1)
                    i--;
                break;
            }
        }

        if(k[i]>=d[n-1])
        {
            //cout << kol;
            brD = k[i]-d[n-1]+1;
            poj += min(kol, brD);
            kol -= max(o, min(kol, brD));
            cout << poj << endl;
        }


    }

    return 0;
}

/*
2 1
1 2
5 10
7
||(d[n-1]<k[i])
long
if(brD>kol)
                {
                    poj += kol;
                    kol = 0;
                }
                else if(brD==kol)
                {
                    poj += kol;
                    kol = 0;
                }
                else
                {
                    poj += brD;
                    kol -= brD;
                }
*/