#include <iostream>
#include <cmath>

#define ull long long

using namespace std;

ull D[300000];
ull R[300001];
ull U[300000];

int main()
{
    int n, q;
    cin >> n >> q;

    for (int i = 0; i<n; i++) {
        ull h;
        cin >> D[i] >> h;
        R[i+1] = R[i] + h;
    }

    U[0] = R[1];
    for (int i = 1; i<n; i++) {
        U[i] = (R[i+1] - R[i]) + max(U[i-1] - (D[i] - D[i-1]), 0ll);
    }

    for (int i = 0; i<q; i++) {
        ull k;
        cin >> k;

        ull res;

        int j = lower_bound(D, D+n, k) - D - 1;
        if (k < D[0]) {
            res = 0;
        } else if (j >= n) {
            res = R[n] - U[n-1] + min(U[n-1] - 1, k - D[n-1]) + 1;
        } else {
            res = R[j+1] - U[j] + min(U[j] - 1, k - D[j]) + 1;
        }
        cout << res << "\n"; 
    }


    return 0;
}