#include <iostream>

using namespace std;

int main()
{
    int n, q;
    long long int d[30005], p[30005], k[30005];
    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, c2 = n, kol = 0, poj=0, brD;
    for(int i = 0; i<q; i++)
    {
        for(int j = c1; j<n; j++)
        {
            kol += p[j];
            if(j>c1)
            {
                brD = d[j] - d[j-1] + 1;
                if(brD>kol)
                {
                    poj += (brD - kol);
                    kol = 0;
                }
                else if(brD==kol)
                {
                    poj += kol;
                    kol = 0;
                }
                else
                {
                    poj = kol-brD;
                    kol -= brD;
                }

            }
            if((j==n-1)||(d[j] <= k[i] && d[j+1] >= k[i]))
            {
                cout << poj;
                c1 = j;
                break;
            }
        }
    }

    return 0;
}

/*
2 1
1 2
5 10
7
||(d[n-1]<k[i])
long
*/