#include <iostream>

using namespace std;


int main(int argc, char const *argv[]) {

    unsigned long long N, Q;

    cin >> N;
    cin >> Q;

    unsigned long long d[N];
    unsigned long long k[N];
    unsigned long long q[Q];

    for(int i = 0;i < N;i++) {
        cin >> d[i];
        cin >> k[i];
    }

    for(int j = 0;j < Q;j++) {
        cin >> q[j];
    }

    int resenje = 0;

    for(int j = 0;j < Q;j++) {

        resenje = 0;

        for(int i = 0;i < N;i++){
            if(q[j] < d[i]) {
                break;
            }else {
                if(q[j] <= d[i] + k[i] - 1) {
                    resenje += q[j] - d[i] + 1;
                } else {
                    resenje += k[i];
                }
            }
        }

        cout << resenje << endl;
    }

    return 0;
}