#include <bits/stdc++.h>

using namespace std;


int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n, q;
    cin >> n >> q;
    vector<long long int> days(n);
    vector<long long int> bought(n);
    long long int gap;
    for (int i = 0; i < n; i++) cin >> days[i] >> bought[i];
    for (int i = 0; i < n - 1; i++){
        gap = days[i + 1] - days[i];
        if (bought[i] > gap){
            bought[i + 1] += bought[i] - gap;
            bought[i] = gap;
        }
    }
    int p = 0;
    long long int qday, extra, total = 0;
    for (int i = 0; i < q; i++){
        cin >> qday;
        while (p + 1 < n && days[p + 1] <= qday){
            total += bought[p];
            p++;
        }
        if (qday < days[0]){
            cout << 0 << endl;
        }
        else{
            if (days[p] + bought[p] > qday){
                extra = qday - days[p] + 1;
            }
            else extra = bought[p];
            cout << total + extra << endl;
        }
    }
    return 0;
}