#include <bits/stdc++.h>
#define endl '\n'
#define int long long

using namespace std;

const long long longlongmax=9223372036854775807;
const int modul=998244353;
const long long mod = 1e9 + 7;


mt19937 mt(chrono::steady_clock::now().time_since_epoch().count());

const int N=300009,INF=3000000000000000000;
deque<pair<int,int>> red;


signed main(){

    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    //freopen("seating.in","r",stdin);
    //freopen("seating.out","w",stdout);

    int n,q;
    cin >> n >> q;
    for(int i=1; i<=n; i++){
        int a,b;cin >> a >> b;
        red.push_back({a,b});
    }
    int tr_rez=0,visak=0,indeks=0;
    //red.push_front({0,0});red.push_back({INF,0});
    while(q--){
        int x;
        cin >> x;
        while(red.size()&&red.front().first<=x){
            if(indeks+visak+1>=red.front().first){
                visak-=red.front().first-indeks-1;
                tr_rez+=red.front().first-indeks-1;

                tr_rez++;
                visak+=red.front().second-1;
            }
            else{
                tr_rez+=visak;
                visak=0;
                tr_rez++;
                visak+=red.front().second-1;
            }
            indeks=red.front().first;
            red.pop_front();
        }
        //cout << tr_rez << " " << indeks << " " << visak << endl;
        if(indeks+visak<x)
            cout << tr_rez+visak << endl;
        else
            cout << tr_rez+x-indeks << endl;
    }



    return 0;
}
/*
    abcde
    01234
    04321 --> 12340
              0   1
    011
    110

1
3 1
1 2 3
3 5

*/