#include <bits/stdc++.h>

using namespace std;

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    
    int n, q;
    cin >> n >> q;
    
    vector<unsigned long long> dan(1), plazma(1);
    cin >> dan[0] >> plazma[0];
    for (int i = 1; i < n; i++) {
        unsigned long long d, p;
        cin >> d >> p;
        if(dan[dan.size()-1]+plazma[plazma.size()-1] >= d){
            plazma[plazma.size()-1] += p;
        }
        else{
            dan.push_back(d);
            plazma.push_back(p);
        }
        
    }
    
    vector<unsigned long long> plazme(plazma.size());
    plazme[0] = plazma[0];
    for (int i = 1; i < plazma.size(); i++) {
        plazme[i] = plazme[i - 1] + plazma[i];
    }
    
    for (int i = 0; i < q; i++) {
        unsigned long long k;
        cin >> k;
        
        auto ind = upper_bound(dan.begin(), dan.end(), k) - dan.begin() - 1;
        
        if (ind == -1) {
            cout << 0 << "\n";
        }
        else {
            
            if ((k-dan[ind]+1) > plazma[ind]){
                cout << plazme[ind] << "\n";
            }
            else{
                cout << plazme[ind]-plazma[ind] + k - dan[ind] + 1 << "\n";
            }
        }
    }

    return 0;
}