#include <iostream>
#include <bits/stdc++.h>
#include <vector>
using namespace std;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    int q;
    cin >> n >> q;
    long long* di = new long long[n];
    int* pi = new int[n];
    for (int i = 0; i < n; i++)
    {
        cin >> di[i] >> pi[i];
    }
    vector<long long> podanu(pi[n-1]+1, 0);
    long long trplzm = 0;
    int trdn = 0;
    for (int i=1; i<podanu.size(); i++)
    {
        podanu[i] = podanu[i-1];
        if (i==di[trdn])
        {
            trplzm += pi[trdn];
            trdn++;
        }
        if (trplzm>0)
        {
            podanu[i]++;
            trplzm--;
        }
    }
    for (int i=0;i<q;i++)
    {
        long long ki;
        cin >> ki;
        if (ki<podanu.size()) cout << podanu[ki] << endl;
        else
        {
            if (ki-podanu.size()>trplzm) cout << podanu[podanu.size()-1]+trplzm << "\n";
            else cout << podanu[podanu.size()-1]+ki-podanu.size() << "\n";
        }
    }
    return 0;
}