#include<iostream>
#include<vector>
using namespace std;
long long pojedeno(const vector<pair<long long, long long>>& a, int n, long long bdt) {
    long long brp = 0;
    for (int i = 0; i < n; i++) {
        if (a[i].first > bdt) break; 
        long long moguca;
        if (i + 1 < n) {
            moguca = min(a[i + 1].first, bdt + 1) - a[i].first;
        } else {
            moguca = bdt + 1 - a[i].first;
        }
        if (a[i].second >= moguca) {
            brp +=moguca; 
        } else {
            brp += a[i].second;
        }
        
    }
    return brp;
}

int main(){
    int n,q; long long bd, k;
    scanf("%d%d", &n, &q);
    vector<pair<long long, long long>> a;
    for (int i = 0; i < n; i++)
    {
        scanf("%lld%lld", &bd, &k);
        a.emplace_back(bd, k);
        
    }
    long long bdt;
    vector<long long> b;
    for (int i = 0; i < q; i++)
    {
        scanf("%lld", &bdt);
        b.push_back(pojedeno(a,n,bdt));

    }
    for (int i = 0; i < q; i++)
    {
        printf("%lld\n", b[i]);

    }
    return 0;
    


}