//ubi cu se majke mi
#include<bits/stdc++.h>
using namespace std;
#define ll long long



int main(){
    cin.tie(NULL);
    ios_base::sync_with_stdio(false);
    ll N, Q;
    cin>>N>>Q;
    vector<ll> dani(N);
    ll vrednost;
    vector<ll> pojedeno(N);
    vector<ll> ostatak(N);
    
    for(ll i = 0; i<N; i++){
        ll vrednost;
        cin>>dani[i];
        cin>>vrednost;
        if(i>0){
            pojedeno[i] = min(dani[i]-dani[i-1], ostatak[i-1])+pojedeno[i-1];
            ostatak[i] = max(vrednost+ostatak[i-1]-dani[i]+dani[i-1], 0LL);
        }if(i==0){
            ostatak[0] = vrednost;
        }
    }


    vector<ll> a;
    for(ll i = 0; i<Q; i++){
        ll danK;
        cin>>danK;
        ll indeks = upper_bound(dani.begin(), dani.end(), danK) - dani.begin() - 1;
        if(indeks == -1){
            a.push_back(0);
        }
        else{
            a.push_back(pojedeno[indeks]+min(danK-dani[indeks], ostatak[indeks]+1)+1);
        }
    }
    for(ll i = 0; i<a.size(); i++){
        cout<<a[i]<<"\n";
    }
    return 0;
}