#include <iostream>
#include <bits/stdc++.h>

using namespace std;

int main()
{
    unsigned long long n,q;
    scanf("%llu%llu",&n,&q);

    unsigned long long d[n+1],p[n+1];

    d[0]=0;
    p[0]=0;

    for(unsigned long long i=1;i<=n;i++)
    {
        unsigned long long a,b;
        scanf("%llu%llu",&a,&b);
        d[i]=a;
        p[i]=b;
    }

    unsigned long long pdt[n+1],ozp[n+1];
    pdt[0]=0;ozp[0]=0;
    for(unsigned long long i=1;i<=n;i++)
    {
        pdt[i]=min(d[i]-d[i-1],p[i-1])+pdt[i-1];
        unsigned long long nula=0;
        ozp[i]=(ozp[i-1]+d[i-1]>d[i]?ozp[i-1]-d[i]+d[i-1]:0)+p[i];
    }

    unsigned long long k[q];
    for(unsigned long long i=0;i<q;i++)
    {
        unsigned long long a;
        scanf("%llu",&a);
        k[i]=a;
    }
    for(unsigned long long i=0;i<q;i++)
    {
        unsigned long long *pok=upper_bound(d,d+n+1,k[i]);
        unsigned long long index = pok - d - 1;
        if(index==0)
            printf("0\n");
        else
        {
            unsigned long long rez=pdt[index]+min(k[i]-d[index]+1,ozp[index]);
            printf("%llu\n",rez);
        }

    }
    return 0;
}