#include <bits/stdc++.h>
using namespace std;

using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vll = vector<ll>;

const int MOD = 1e9 + 7;
const int INF = 1e9;
const ll LINF = 1e18;
const ld EPS = 1e-9;

#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define sz(x) ((int)(x).size())

void solve() {

    ll N, Q;
    cin >> N >> Q;
    vector<pll> kupovanja(N);
    for(int i = 0; i < N; i++) cin >> kupovanja[i].fi >> kupovanja[i].se;

    vll pocetak, kraj;
    ll zadnji_dan = 0;
    for(int i = 0; i < N; i++){
        ll d = kupovanja[i].fi;
        ll p = kupovanja[i].se;
        ll pocetak1;
        if(d > zadnji_dan + 1){
            pocetak1 = d;
        }
        else{
            pocetak1 = zadnji_dan +1;
        }
        ll kraj1 = pocetak1 + p - 1;
        pocetak.pb(pocetak1);
        kraj.pb(kraj1);
        zadnji_dan = kraj1;
    }

    int vel = sz(pocetak);
    vll pref(vel, 0);
    if(vel > 0){
        pref[0] = kraj[0] - pocetak[0] + 1;
        for(int i = 1; i < vel; i++) pref[i] = pref[i-1] + (kraj[i] - pocetak[i] + 1);
    }

    while(Q--){

        ll k;
        cin >> k;

        ll r = -1;
        if(vel > 0){
            r = upper_bound(all(kraj), k) - kraj.begin() - 1;
        }
        ll pojedeno = 0;
        if(r >= 0){
            pojedeno += pref[r];
        }
        if(r + 1 < vel && pocetak[r+1] <= k){
            pojedeno += min(kraj[r+1], k) - pocetak[r+1] + 1;
        }
        cout << pojedeno << "\n";
    }
}


int main() {

    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    int t = 1;
    // cin >> t;
    while (t--) solve();
    return 0;
}