#include <iostream>
#include <algorithm> 
using namespace std;

int n, q;

long long calc(long long d[], long long p[], long long val) {
    long long br = 0, tr = p[0];

    if (d[0] > val) 
        return 0;

    for (int i = 1; i < n; i++) {

        if (val > d[i - 1] && val < d[i]) {
            br += min(tr, val - d[i - 1] + 1);
            return br;
        }

        if (d[i] - d[i - 1] > tr) {
            br += tr;
            tr = p[i];
        } else {
            br += d[i] - d[i - 1];
            tr = tr - (d[i] - d[i - 1]) + p[i];
        }
    }

    if (tr > 0) 
        return br + min(tr, val - d[n - 1] + 1);
    
    return br;
}

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

    long long d[n], p[n], k[q];

    for (int i = 0; i < n; i++) 
        cin >> d[i] >> p[i];
    

    for (int i = 0; i < q; i++) 
        cin >> k[i];    
    // Kraj unosa!

    for (int j = 0; j < q; j++) 
        cout << calc(d, p, k[j]) << endl;;
    
}