#include <iostream>

using namespace std;

int main()
{
    int n, q; // n - ukupan broj dana kojima je uspeo da nadje plazmu, q - broj pitanja
    
    cin >> n >> q;
    
    int d[n + 1];
    long long p[n + 1];
    d[0] = 0;
    p[0] = 0;
    long long k[q];
    
    for (int i = 1; i < n + 1; i++) cin >> d[i] >> p[i];
    for (int i = 0; i < q; i++) cin >> k[i];
    
    for (int i = 1; i < n + 1; i++) {
        p[i] = p[i] + p[i - 1];
    }
    
    for (int i = 0; i < q; i++) {
        int idx = lower_bound(d + 1, d + n + 1, k[i]) - d - 1;
        long long dan = d[idx];
        long long razl = k[i] - dan + 1;
        long long prosli = idx != 0 ? p[idx - 1] : 0;
        long long trenutni = p[idx];
        // cout << "---------------------" << endl;
        // cout << "k[i] ->" << k[i] << endl;
        // cout << "dan ->" << d[idx] << endl;
        // cout << "idx -> " << idx << endl;
        // cout << "razl -> " << razl << endl;
        // cout << "prosli -> " << prosli << endl;
        // cout << "trenutni -> " << trenutni << endl;
        cout << min(trenutni, prosli + razl) << endl;
    }
    
    // for (int i = 0; i < n; i++) {
    //     cout << d[i] << endl;
    // }
    
    return 0;
}