#include<stdio.h>
#include<stdlib.h>
typedef struct Cvor{
    unsigned long long dan,brplazmi;
    struct Cvor *sl;
}Cvor;
typedef struct CvorQ{
    unsigned long long br;
    struct CvorQ *sl;
}CvorQ;
CvorQ* UpisNaPocetakQ(unsigned long long N){
    CvorQ *n,*k,*p;unsigned long long d;
    p=k=NULL;
    for(int i=0;i<N;i++){
        scanf("%llu",&d);
        n=(CvorQ*)malloc(sizeof(CvorQ));
        n->br=d;
        n->sl=NULL;
        if(p==NULL)p=n;
        else k->sl=n;
        k=n;
    }
    return p;
}
Cvor* UpisNaPocetakN(unsigned long long N){
    Cvor *n,*k,*p;unsigned long long d,p1;
    p=k=NULL;
    for(int i=0;i<N;i++){
        scanf("%llu%llu",&d,&p1);
        n=(Cvor*)malloc(sizeof(Cvor));
        n->dan=d;
        n->brplazmi=p1;
        n->sl=NULL;
        if(p==NULL)p=n;
        else k->sl=n;
        k=n;
    }
    return p;
}
void IspisQ(CvorQ* N){
    CvorQ *t;
    t=N;
    while(t!=NULL){
         printf("%llu\n",t->br);
         t=t->sl;
    }
}
void IspisN(Cvor* N){
    Cvor *t;
    t=N;
    while(t!=NULL){
         printf("%llu %llu\n",t->dan,t->brplazmi);
         t=t->sl;
    }
}
//broji SVAKI dan (za 7 ispadne osam jer se racuna i sedmi, itd)
int OdgovorNaPitanje(Cvor* Narray,unsigned long long k){
    Cvor* t=Narray;int brpu=0,tslp=0,tdan;
    while(t->dan<=k && t->sl!=NULL){
        if(t->sl==NULL || t->sl->dan>k)tdan=k;
        else tdan=t->sl->dan;
        if(t->brplazmi+tslp>tdan-t->dan){
            brpu+=tdan-t->dan;
            tslp+=t->brplazmi-(tdan-t->dan);
        }
        else{
            brpu=t->brplazmi+tslp;
            tslp=0;
        }
        t=t->sl;
    }
    if(tslp>=k)brpu++;
    else if(t->sl==NULL)brpu+=tslp;
    return brpu;
}
int main(){
    unsigned long long N,Q;
    Cvor *Narray;
    CvorQ *Qarray,*k;
    scanf("%llu%llu",&N,&Q);
    Narray=UpisNaPocetakN(N);
    Qarray=UpisNaPocetakQ(Q);
    k=Qarray;
    for(int i=0;i<Q;i++){
        printf("%d\n",OdgovorNaPitanje(Narray,k->br));
        k=k->sl;
    }
    return 0;
}