#include<iostream>
using namespace std;
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n,q;
    cin>>n>>q;
    long long d[n+1];
    long long p[n+1];
    for(int i=1;i<=n;i++)
    {
        cin>>d[i]>>p[i];
    }
    long long k[q];
    for(int i=0;i<q;i++)
        cin>>k[i];
    long long sum=0;
    long long brk=0;
    long long pojedeno=0;
    for(int i=1;i<=n;i++)
    {
        sum=sum+p[i];
        long long kraj=d[i]+sum-1;
        while(k[brk]<d[i])
        {
            cout<<pojedeno<<endl;
            brk++;
        }
        if(i==n || kraj<d[i+1])
        {
            while(k[brk]<=kraj)
            {
                cout<<pojedeno+k[brk]-d[i]+1<<endl;
                brk++;
            }
            pojedeno=pojedeno+kraj-d[i]+1;
            sum=0;
        }
        else
        {
            while(k[brk]<=d[i+1])
            {
                cout<<pojedeno+k[brk]-d[i]+1<<endl;
                brk++;
            }
            sum=sum+d[i]-d[i+1];
            pojedeno=pojedeno+d[i+1]-d[i];
        }
    }
    while(brk<q)
    {
        cout<<pojedeno<<endl;
        brk++;
    }

}