#include <bits/stdc++.h>
using namespace std;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int n,q;
    cin >> n >> q;
    vector<long long> d(n);
    vector<int> p(n);
    vector<long long> k(q); //upiti
    vector<long long> rere(n); //resenje>???
    vector<long long> rerepla(n);
    for(int i=0; i<n; i++){
        cin >> d[i] >> p[i];
    }
    for(int i=0; i<q; i++){
        cin >> k[i];
    }
    long long kol=p[0]-1; //kolicina plazme
    rere[0]=1;
    rerepla[0]=p[0]-1;
    for(int i=1; i<n; i++){
        if(kol>=d[i]-d[i-1]){
            rere[i]=rere[i-1]+(d[i]-d[i-1]);
            kol-=d[i]-d[i-1];
        }
        if(kol<d[i]-d[i-1]){
            rere[i]=p[i-1]+1;
            kol-=p[i-1];
        }
        kol+=p[i];
        rerepla[i]=kol;
    }
 
    for(int i=0; i<q; i++){
    
    auto it = upper_bound(d.begin(), d.end(), k[i])-d.begin();
  
    if(it==0) cout << 0 << endl;
    else{
        it--;
        if(k[i]==d[it]) cout<<rere[it]<<endl;
        else if(k[i]>=rerepla[it] +d[it]) cout<<rere[it]+rerepla[it]<<endl;
        else if(k[i]<rerepla[it]+d[it]) cout<<rere[it]+(k[i]-d[it])<<endl;
    }

   }

return 0;}