#include <iostream>
using namespace std;

int main() {
    int n, q,j=0;
    cin >> n >> q;
    long long d[n],p[n],k[q],na_raspolaganju[n],moze_dotad_da_apa[n],odg[q];
    
    //
    cin>>d[0]>>p[0];
    moze_dotad_da_apa[0]=1;
    na_raspolaganju[0]=p[0]-1;
    for(int i=1;i<n;i++){
        cin>>d[i]>>p[i];
        if(d[i]-d[i-1]<na_raspolaganju[i-1]){
            moze_dotad_da_apa[i]=moze_dotad_da_apa[i-1]+d[i]-d[i-1]+1;
            na_raspolaganju[i]=na_raspolaganju[i-1]-d[i]+d[i-1]+p[i]-1;
        }
        else if(d[i]-d[i-1]==na_raspolaganju[i-1]){
            na_raspolaganju[i]=p[i];
            moze_dotad_da_apa[i]=moze_dotad_da_apa[i-1]+na_raspolaganju[i-1];
        }
        else{
            na_raspolaganju[i]=p[i]-1;
            moze_dotad_da_apa[i]=moze_dotad_da_apa[i-1]+na_raspolaganju[i-1]+1;
            
        }
    }
    //
    
    for(int i=0;i<q;i++){
        cin>>k[i];
        while(k[i]>=d[j]&&j<n){
            j++;
        }
        if(j==0)
        odg[i]=0;
        else{
            if(k[i]-d[j-1]<=na_raspolaganju[j-1])
            odg[i]=moze_dotad_da_apa[j-1]+k[i]-d[j-1];
            else
            odg[i]=moze_dotad_da_apa[j-1]+na_raspolaganju[j-1];
        }
    }
    
    cout<<endl;
    for(int i=0;i<q;i++){
        cout<<odg[i]<<endl;
    }
    
    return 0;
}