#include <bits/stdc++.h>
using namespace std;
struct slog{
    long long ind, val, jede;
}n[300005];

bool cmp(slog a, slog b){
    return (a.ind < b.ind);
}

long long N, Q, a, b, sol;
int main(){
    cin >> N >> Q;
    n[0].ind = 0;n[0].val = 0;n[0].jede = 0;
    for(int i = 1; i <= N; i++){
        cin >> a >> b;
        n[i].ind = a;
        n[i].val = b;
        n[i].jede = 0;
    }
    sort(n + 1, n + N + 1, cmp);
    for(int i = 2; i <= N; i++){
        n[i].val += n[i-1].val;
        n[i].jede = n[i-1].jede + min((n[i].ind - n[i-1].ind), n[i-1].val - n[i-1].jede);
    }

    cin >> a;
    int l = 0;
    for(int i = 1; i <= N; i++){
        if(n[i].ind <= a) l = i;
    }


    sol = min((a - n[l].ind), n[l].val - n[l].jede - 1) + n[l].jede + 1;
    cout << sol << endl;


    for(int i = 2; i <= Q; i++){
        cin >> a;
        while(n[l].ind <= a and l <= N){
         l++;
        }
        l--;
        sol = min((a - n[l].ind), n[l].val - n[l].jede - 1) + n[l].jede + 1;
        cout << sol << endl;


    }
return 0;
}