#include <bits/stdc++.h>
using namespace std;
struct par{
    long long from;
    long long to;
};
int main(){
    int n,q;
    long long d,p;
    vector<par> v;
    cin >> n >> q;
    cin >> d >> p;
    par temp; temp.from = d; temp.to = (d+p)-1;
    v.push_back(temp);
    for(int i = 1; i < n; i++){
        cin >> d >> p;
        if(v.back().to >= d-1) {v.back().to+=p;}
        else {par temp; temp.from = d; temp.to = (d+p)-1; v.push_back(temp);}
    }
    p = 0;
    for(int i = 0; i < q; i++){
        cin >> d;
        for(par t:v){
            if(d < t.from) break;
            if(d <= t.to && d >= t.from){p+=(d-t.from)+1; break;}
            p += (t.to-t.from)+1;
        }
        cout << p << "\n";
        p = 0;
    }
    return 0;
}