/// ! 704/ 10^, )!3!+¿!¡/[!]
#include<bits/stdc++.h>

using namespace std;

#define ll long long
#define dl double long
#define str string
#define vi vector<int>
#define vl vector<ll>
#define vvi vector<vi>
#define pi pair<int, int>
#define vp vector<pi>
#define pb push_back
#define popb pop_back
#define f first
#define s second
#define t third
#define ti triple<int, int, int>

const int MOD = 1e9 + 7;
const int N = 2e5 + 5;

ll binpow(ll a, ll b) {
    ll res = 1;
    while(b > 0){
        if(b & 1)
            res = res * a;
        a = a * a;
        b >>= 1;
    }
    return res;
}

void solve(){
    ll n, q;
    cin >> n >> q;
    ll d[n], p[n];
    vector<pair<ll, ll>> inter;
    cin >> d[0] >> p[0];
    inter.pb({d[0], d[0] + p[0] - 1});
    for(ll i = 1; i < n; i++){
        cin >> d[i] >> p[i];
        if(inter[inter.size() - 1].s >= d[i]) inter[inter.size() - 1].s += p[i];
        else inter.pb({d[i], (p[i] - 1) + d[i]});
    }
    ll k[q];
    vl res(q, 0);
    ll j1 = 0;
    for(ll i = 0; i < q; i++){
        cin >> k[i];
        for(ll j = j1; j < inter.size(); j++){
            if(inter[j].s <= k[i]) res[i] += (inter[j].s - inter[j].f + 1);
            else if(inter[j].s >= k[i] && inter[j].f <= k[i]){
                res[i] += (k[i] - inter[j].f + 1);
                inter[j].f = k[i] + 1;
                j1 = j;
                break;
            }
            else{
                j1 = j;
                break;
            }
        }
        if(i > 0) res[i] += res[i - 1];
    }
    for(int i = 0; i < q; i++) cout << res[i] << "\n";

}

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