#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
void DBG() { cerr << "]" << endl; }
template<class H, class... T> void DBG(H h, T... t) { cerr << to_string(h); if(sizeof...(t)) cerr << ", "; DBG(t...); }
#define dbg(...) cerr << "[" << #__VA_ARGS__ << "]: [", DBG(__VA_ARGS__)

const int N = 3e5 + 3;
const ll inf = 1e18;
ll d[N], po[N], ans[N], ost[N];

void solve() {
    int n, q; cin >> n >> q;
    for (int i = 1; i <= n; i++) {
        cin >> d[i] >> po[i];
    }
    ll u = 0;
    for (int i = 1; i <= n; i++) {
        ans[i] = ans[i-1] + min(u, d[i]-d[i-1]);
        u = max(0ll, u - (d[i]-d[i-1]));
        u += po[i];
        u = min(u, inf);
        ost[i] = u;

    }

    int p = 0;
    while (q--) {
        ll k; cin >> k;
        while (p < n && d[p+1] <= k)
            p++;

        ll cur = ans[p], u = ost[p];
        cur += (min(k-d[p]+1, u));

        cout << cur << "\n";
    }
}

signed main() {
    ios::sync_with_stdio(false); cin.tie(0);
	int t=1; //cin >> t;
	while (t--) {
        solve();
	}
}