#include <bits/stdc++.h>
#define ll long long int
#define pi pair<int, int>
#define pb push_back

using namespace std;

const int nmax=300005;

ll dani[nmax];
ll kupovine[nmax];
ll nakon[nmax];
ll prefiksne[nmax];

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);

    int n, q;
    cin>>n>>q;
    for(int i=1; i<n+1; i++)
    {

        cin>>dani[i]>>kupovine[i];
    }
    for(int i=1; i<n+1; i++)
    {
        prefiksne[i]=prefiksne[i-1]+kupovine[i];
        ll br=0;
        nakon[i]=max(br, nakon[i-1]-(dani[i]-dani[i-1]-1))+kupovine[i]-1;
    }
    dani[n+1]=LLONG_MAX;
    ll kj, ans;
    int i=0;
    while(q--)
    {
        cin>>kj;
        while(dani[i]<=kj) i++;
        i--;
        ans=prefiksne[i]-nakon[i]+min(kj-dani[i], nakon[i]);
        cout<<ans<<"\n";
    }
}
/*
5 3
1 3
3 1
6 7
11 4
15 2
8
4
23
*/