#include <bits/stdc++.h>
using namespace std;
#define ll long long

int main() {
    
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    
    int n, q; cin >> n >> q;
    vector<ll> d(n), p(n,0), r(n);
    
    for(int i=0;i<n;i++){
        cin >> d[i] >> p[i];
    }

    for(int i=1;i<n;i++){
        if(p[i-1] > d[i] - d[i-1]){
            p[i] += p[i-1] - (d[i] - d[i-1]);
            r[i] = r[i-1] + d[i] - d[i-1]; 
        }
        else{
            r[i] = r[i-1] + p[i-1];
        }
    }

    ll k;

    for(int i=0;i<q;i++){
        cin >> k;
        ll bi = upper_bound(d.begin(), d.end(), k) - d.begin();
        if(bi == 0){
            cout << "0\n";
        }
        else{
            cout << r[bi-1] + min(p[bi-1], k - d[bi-1] + 1) << '\n';
        }
    }
    return 0;
}