#include <bits/stdc++.h>

using namespace std;

#define MAXN 300001
#define int long long

int n,q;
int d[MAXN],p[MAXN];
int pojela[MAXN],zalihe[MAXN];

int32_t main()
{
    cin>>n>>q;
    for (int i=1;i<=n;i++) cin>>d[i]>>p[i];
    for (int i=2;i<=n;i++)
    {
        zalihe[i]=zalihe[i-1]+p[i-1];
        pojela[i]=min(d[i]-d[i-1],zalihe[i])+pojela[i-1];
        zalihe[i]-=min(d[i]-d[i-1],zalihe[i]);
    }
    for (int i=1;i<=q;i++)
    {
        int x;cin>>x;
        int l=1,r=n,rez=0;
        while (l<=r)
        {
            int mid=(l+r)/2;
            if (d[mid]<=x) {rez=mid;l=mid+1;}
            else r=mid-1;
        }
        int brdana=x-d[rez]+1;
        cout<<pojela[rez]+min(zalihe[rez]+p[rez],brdana)<<endl;
    }
}