#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;
    long long brkeksa=0;
    for (int i = 0; i < n; i++) {
        brkeksa+=a[i].second;
        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 (brkeksa >= moguca) {
            brp +=moguca;
            brkeksa-=moguca; 
        } else {
            brp += brkeksa;
            brkeksa=0;
        }
        
    }
    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;
    for (int i = 0; i < q; i++)
    {
        scanf("%lld", &bdt);
        printf("%lld\n",pojedeno(a,n,bdt));

    }
    return 0;
    


}