#include <bits/stdc++.h>
using namespace std;
long long N, M,DG,gladnidani;
struct a {
long long dan;
long long kupio;
}p[300022];
long long a[300022];
int main () {
    cin>>N>>M;
    for(int i=1 ; i<= N; i++){
        cin>>p[i].dan;
        cin>>p[i].kupio;
    }
    
    for(int i=1 ; i<= M; i++){
        cin>>a[i];
    }
    long long j=1;
    long long i=1;
    DG=0;
    gladnidani=0;
    while(j<=M){
        if(a[j]>p[i].dan and  i<=N){
            if(p[i].dan>DG){
                gladnidani+= p[i].dan-DG-1;
                DG=p[i].dan+p[i].kupio-1;
            }else{
                DG+=p[i].kupio;
            }
            i++;
        }else{
            if(i==1){
                cout<<0<<endl;
            }else if(a[j] < DG){
                cout<<a[j]-gladnidani<<endl;
            }else{
                cout<<DG-gladnidani<<endl;
            }
            j++;
        }
    }
    return 0;
}