#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;
    }
}
unsigned long long OdgovorNaPitanje(Cvor* Narray,unsigned long long k){
    Cvor* t=Narray;unsigned long long brpu=0,brdana,brplaz,tslp=0;
    while(t->sl!=NULL && t->sl->dan<=k){
        if(t->brplazmi+tslp>(t->sl->dan-t->dan)){
            brpu+=t->sl->dan-t->dan;
            tslp+=t->brplazmi-(t->sl->dan-t->dan);
        }
        else{
        brpu+=t->brplazmi+tslp;
        tslp=0;
        }
        t=t->sl;
    }
    brdana=t->dan;
    brplaz=t->brplazmi;
    while(brdana<=k){
        brdana++;
        if(brplaz!=0){
            brpu++;
            (brplaz)--;
    }
    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("%llu\n",OdgovorNaPitanje(Narray,k->br));
        k=k->sl;
    }
    return 0;
}