#include <bits/stdc++.h>
#define endl '\n'
using namespace std;
#define int long long
//typedef long long int lint;

void solve(){
    int n, q;
    cin >> n >> q;
    n++;
    vector<int> d(n);
    d[0] = 0;
    vector<int> p(n);
    p[0] = 0;
    vector<int> dosad(n);
    dosad[0] = 0;
    vector<int> ima(n);
    ima[0] = 0;
    for(int i = 1; i < n; i++){
        cin >> d[i];
        cin >> p[i];
    }
    for(int i = 1; i < n; i++){
        dosad[i] = dosad[i - 1] + min((d[i] - d[i - 1] - 1), ima[i - 1]) + 1;
        ima[i] = p[i] - 1 + max((ima[i - 1] - d[i] + d[i - 1] + 1), (int)0);
    }
    while(q--){
        int b;
        cin >> b;
        int it = distance(d.begin(), upper_bound(d.begin(), d.end(), b)) - 1;
        cout << (dosad[it] + min((b - d[it]), ima[it])) << endl;
    } 
}   
 


signed main(){
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    int t = 1;
    //cin >> t;
    while(t--){
        solve();
    }
    return 0;
}