#include <iostream>
#include <list>
#include <algorithm>
#define ll long long

using namespace std;

int main(){
    ios_base::sync_with_stdio(0);cin.tie(0);
    ll n,q;
    cin>>n>>q;
    list<ll> dani {0};
    for(ll i=0;i<n;i++){
        ll dan,kolicina;
        cin>>dan>>kolicina;
        ll pocetak=dan;
        if(dani.back()>=pocetak){
            pocetak=dani.back()+1;
        }
        for(ll j=pocetak;j<pocetak+kolicina;j++){
            dani.push_back(j);
        }

               
    }
    list<ll> output;
    for(ll i=0;i<q;i++){
        ll dan;
        ll out=0;
        cin>>dan;
        for(ll j =1;j<dan+1;j++){
            if(find(dani.begin(), dani.end(), j) != dani.end()){
                out++;
            }
        }
        output.push_back(out);
    }
    for(ll i=0;i<output.size();i++){
        auto front=dani.begin();
        advance(front, i);
        cout<<*front<<endl;
    }
}