#include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <algorithm>
#include <cmath>
#include <deque>

using namespace std;

#define int long long

signed main()
{
    int n, q, d, p, plazma = 0, ate = 0, j=1;
    cin >> n >> q;
    queue<pair<int, int>>dp;
    for (int i = 0; i < n; i++)
    {
        cin >> d >> p;
        dp.push({ d, p });
    }
    vector<int>Q(q);
    for (int i = 0; i < q; i++)
    {
        cin >> Q[i];
    }
    vector<int>ans(Q.back()+1);
    for (int i = 1; i < Q.back()+1; i++)
    {
        if (dp.size() && i == dp.front().first)
        {
            plazma += dp.front().second;
            dp.pop();
        }
        if (plazma != 0)
        {
            plazma--;
            ate++;
        }
        ans[i] = ate;;
    }
    for (auto i : Q)
    {
        cout << ans[i] << '\n';
    }
}