#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#define ll long long

using namespace std;

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

    ll n, q, di, pi, ki;
     cin>>n>>q;
    vector<ll>pojedeno(n+1, 0);
    vector<ll>pref(n+1, 0);
    vector<ll>dani(n+1, 0);

  //  cin>>n>>q;
    pojedeno[1]=1;
    for(ll i=1; i<n+1; i++){
        cin>>dani[i]>>pi;
        pref[i]=pref[i-1]+pi;
        pojedeno[i]=pojedeno[i-1]+min(dani[i]-dani[i-1]-1, pref[i-1]-pojedeno[i-1])+1;
    }

    /*for(auto a : dani){
        cout<<a<<" ";
    }
    cout<<endl;

    for(auto a : pref){
        cout<<a<<" ";
    }
    cout<<endl;

    for(auto a : pojedeno){
        cout<<a<<" ";
    }
    cout<<endl;*/


    for(ll i=0; i<q; i++){
        cin>>ki;
        ll low = (lower_bound(dani.begin(), dani.end(), ki) - dani.begin()) -1;
        cout<<pojedeno[low]+min(pref[low]-pojedeno[low], ki-dani[low])<<endl;
    }
}