#include <bits/stdc++.h>

#define int long long

using namespace std;

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n, q;
    cin >> n >> q;
    vector<int> d(n + 1);
    vector<int> p(n + 1);
    for(int i = 1; i <= n; i++) {
        int u, v;
        cin >> u >> v;
        d[i] = u;
        p[i] = v;
    }
    vector<int> current(n + 1);
    vector<int> ans(n + 1);
    ans[1] = 0;
    current[1] = p[1];
    for(int i = 2; i <= n; i++) {
        ans[i] = ans[i - 1] + min(current[i - 1], d[i] - d[i - 1] + 1);
        current[i] = current[i - 1];
        current[i] -= min(current[i - 1], d[i] - d[i - 1] + 1);
        current[i] += p[i];
    }
    while(q--) {
        int x;
        cin >> x;
        int l = 1, r = n, index = - 1;
        while(l <= r) {
            int mid = (l + r) / 2;
            if(x >= d[mid]) {
                l = mid + 1;
                index = mid;
            }
            else {
                r = mid - 1;
            }
        }
        if(index == - 1) {
            cout << 0 << "\n";
        }
        else {
            cout << ans[index] + min(current[index], x - d[index] + 1) << "\n";
        }
    }
}