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

#define MAX_N 300000
#define MAX_Q 300000

typedef struct {
    long long dan;
    long long pak;
} Plazma;

Plazma p[MAX_N];
long long pit[MAX_Q];
long long odg[MAX_Q];

void mod(Plazma p[], int n) {
    for (int i = 0; i < n- 1; i++) {
        long long raz = p[i + 1].dan - p[i].dan;
        if (p[i].pak > raz) {
            long long e = p[i].pak - raz;
            p[i].pak = raz;
            p[i + 1].pak += e;
        }
    }
}

int poredi(const void *a, const void *b) {
    return ((Plazma *)a)->dan - ((Plazma *)b)->dan;
}

long long resi(long long d, int n,Plazma p[]) {
    int left = 0, right = n - 1;

    while (left <= right) {
        int mid = left + (right - left) / 2;
        if (p[mid].dan <= d) {
            left = mid + 1;
        } else {
            right = mid - 1;
        }
    }

    if (right == -1)
        return 0;
    long long s=0;
    if(d-p[right].dan+1>=p[right].pak)
    {
        
        for(int i=0;i<=right;i++)
        {
            s+=p[i].pak;
        }
    }
    else
    {
        for(int i=0;i<right;i++)
        {
            s+=p[i].pak;
        }
        s+=d-p[right].dan+1;
    }
    return s;
}

int main() {
    int n, q;
    scanf("%d %d", &n, &q);

    for (int i = 0; i < n; i++) {
        scanf("%lld %lld", &p[i].dan, &p[i].pak);
    }
    qsort(p, n, sizeof(Plazma), poredi);
    mod(p, n);
    for (int i = 0; i < q; i++) {
        scanf("%lld", &pit[i]);
    }
    for (int i = 0; i < q; i++) {
        odg[i] =resi(pit[i], n,p);
    }

    for (int i = 0; i < q; i++) {
        printf("%lld\n", odg[i]);
    }

    return 0;
}