#include <iostream>
#include <queue>
using namespace std;

unsigned long long int o = 0;

unsigned long long int ans[300000];
long long int temp1;
int temp2;
queue<long long int> d;
queue<int> p;
long long int prevdan = 0;
long long int prevpla = 0;
long long int k = 0;
long long int pk;

int main()
{
    int n, q;
    cin >> n >> q;
    
    for (int i = 0; i < n; i++)
    {
        cin >> temp1;
        d.push(temp1);
        cin >> temp2;
        p.push(temp2);
    }
    
    for (int i = 0; i < q; i++)
    {
        pk = k;
        cin >> k;
        if (i != 0) ans[i] = ans[i - 1];  else ans[i] = 0;
        if (i == 0 and k < d.front()) ans[0] = 0;
        else if (!d.empty() and k >= d.front())
        {
            if ((d.front() - pk - 1) < o)
            {
                o = o - d.front() + pk + 1;
                ans[i] += d.front() - pk;
            }
            else
            {
                ans[i] += (o + 1);
                o = 0;
            }
            p.front() -= 1;
            prevdan = d.front();
            prevpla = p.front();
            d.pop();
            p.pop();
            while (!d.empty() and d.front() <= k)
            {
                if ((d.front() - prevdan - 1) < (o + prevpla))
                {
                    o = o + prevpla - d.front() + prevdan + 1;
                    ans[i] += d.front() - prevdan;
                }
                else
                {
                    ans[i] += o + prevpla + 1;
                    o = 0;
                }
                p.front() -= 1;
                prevdan = d.front();
                prevpla = p.front();
                d.pop();
                p.pop();
            }
            if ((k - prevdan) < (o + prevpla))
            {
                o = o + prevpla - k + prevdan;
                ans[i] += k - prevdan;
            }
            else
            {
                ans[i] += o + prevpla;
                o = 0;
            }
        }
        else
        {
            if ((k - pk) < o)
            {
                o = o - k + pk;
                ans[i] += k - pk;
            }
            else 
            {
                ans[i] += o; 
                o = 0;
            }
        }
    }

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