#include <bits/stdc++.h>
#define ll long long
#define MAXN 300010
using namespace std;
ll d[MAXN],p[MAXN];
int main()
{
    ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    ll n,q,k;
    cin >> n >> q;
    for (ll i=1;i<=n;i++)
        cin >> d[i] >> p[i];
    ll pos=0,cnt=0,dan=0,ans=0;
    while (q--)
    {
        cin >> k;
        while (pos<n && d[pos+1]<=k)
        {
            pos++;
            ll num=min(cnt,d[pos]-dan-1);
            cnt-=num;
            ans+=num;
            cnt+=p[pos];
            dan=d[pos];
            if (cnt)
            {
                ans++;
                cnt--;
            }
        }
        ll num=min(cnt,k-dan);
        ans+=num;
        cnt-=num;
        dan=k;
        cout << ans << "\n";
    }
    return 0;
}