#include <stdio.h>
#include <stdlib.h>

int main()
{
    long int p,q;
    scanf("%ld%ld",&p,&q);
    long long int d[p],k[p],bq[p];

    for(long int i=0;i<p;i++){
        scanf("%lld%lld",&d[i],&k[i]);
    }
    for(long int i=0;i<q;i++){
        scanf("%lld",&bq[i]);
    }
    for(long int i=0;i<q;i++){
        long long int bpp=0,bsp=0;
        long int j=0;
        while(j<p && d[j]<=bq[i]){
            if(j==0){
            bsp=bsp+k[j]-1;
            bpp++;
            }
            else{
                bpp=bpp+((d[j]-d[j-1]-1>=bsp)?bsp:(d[j]-d[j-1]-1));
                bsp=bsp+k[j]-1-((d[j]-d[j-1]-1>=bsp)?bsp:(d[j]-d[j-1]-1));
                bpp++;
            }

            j++;
        }
        if(j!=0 && bq[i]>d[j-1]){
            bpp=bpp+((bq[i]-d[j-1]>=bsp)?bsp:(bq[i]-d[j-1]));
        }
        printf("%lld\n",bpp);
    }


    return 0;
}