#include <iostream>
#include <cmath>
#include <list>
#include <vector>
#include <algorithm>
#include <bitset>
#include <string>
#include <set>
#include <map>
#include <queue>
#define ll int64_t
#define int int64_t
#define VI vector<ll>
#define rep(i,a,b) for (int i=a;i<=b;i++)
#define per(i,a,b) for (int i=a;i>=b;i--)
#define load(a) for (auto& x : a) cin >> x
#define unload(a) for(auto x: a) cout << x << " "

using namespace std;
const int N = 2e5+20; ll A[N], n;

ll bs(VI niz, ll l, ll r, ll e){
    ll s;
    while(l <= r){
        s = l + (r-l) / 2;
        if(niz[s] == e) return s;
        if(niz[s] < e) l = s + 1;
        else r = s - 1;
    }
    if(niz[s] > e) s--;
    return s;
}

void solve(){
    ll q;
    cin >> n >> q;
    VI dani(n+1, 0);
    VI plazma(n+1, 0);
    VI ukupno(n+1, 0);
    VI kraj(n+1, 0);
    VI pitanja(q,0);
    rep(i,1,n){
        ll d, p;
        cin >> d >> p;
        dani[i] = d;
        plazma[i] = p;
        ukupno[i] = ukupno[i-1] + p;
        kraj[i] = kraj[i-1] + p - min(dani[i] - dani[i-1], kraj[i-1] + 1);
    }
    rep(i,0,q-1){ll pitanje; cin >> pitanje; pitanja[i] = pitanje;}
    rep(i,0,q-1){
        ll pitanje = pitanja[i];
        ll index = bs(dani, 0, n, pitanje);
        cout << ukupno[index] - kraj[index] + min(kraj[index], pitanje-dani[index]) << endl;
    }
    return;
}

int32_t main() {
    ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    solve();
    return 0;
}