#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long

using namespace std;


int main()
{
    ios_base::sync_with_stdio(false);

    int n, q;
    cin >> n >> q;
    ll d, p;
    // dani[i][0] d
    // dani[i][1] koliko je Plazma® keksa pojela zakljucno sa d-tim danom
    // dani[i][2] koliko je Plazma® keksa ostalo zakljucno sa d-tim danom
    vector< vector<ll> > dani(n+1, vector<ll>(3, 0));
    for(int i = 1; i <= n; i++){
        cin >> d >> p;
        ll pojela = min(d-dani[i-1][0]-1, dani[i-1][2]);
        dani[i][0] = d;
        dani[i][1] = dani[i-1][1] + pojela;
        dani[i][2] = p + dani[i-1][2] - pojela;
        if(dani[i][2] > 0){
            dani[i][2]--;
            dani[i][1]++;
        }
    }
//    cout << "DANI: " << endl;
//    for(int i = 0; i <= n; i++){
//        for(int j = 0; j < 3; j++) cout << dani[i][j] << "\t";
//        cout << endl;
//    }
//    cout << endl;
    ll k;
    for(int i = 0; i < q; i++){
        cin >> k;
        auto clan = *prev(upper_bound(dani.begin(), dani.end(), 0, [k](const auto _, const auto B){
                                            if(k < B[0]) return true;
                                            return false;
                                      }));
//        cout << "clan: " << clan[0] << " " << clan[1] << " " << clan[2] << endl;
        ll rez = clan[1] + min(k-clan[0], clan[2]);
        cout << rez << endl;
    }
}