#include <bits/stdc++.h>
#define endl '\n'
#define fi first
#define se second
#define pb push_back
#define yes "YES"
#define no "NO "

using namespace std;

using ll = long long;
const ll inf=1e18;
using ld = long double;


void solve()
{
    ll n,q,i,novon,x,l,r,mid,res;
    cin >> n >> q;
    vector<pair<ll,ll>>dan(n),novi;
    for(auto &x:dan)
    {
        cin >> x.fi >> x.se;
    }
    for(i=0;i<n-1;i++)
    {
        if(dan[i].fi+dan[i].se>=dan[i+1].fi)
        {
            dan[i+1].fi=dan[i].fi;
            dan[i+1].se=dan[i+1].se+dan[i].se;
            dan[i].fi=-1;
        }
    }
    for(i=0;i<n;i++)
    {
        if(dan[i].fi==-1)
        {
            continue;
        }
        novi.pb(dan[i]);
    }
    novon=novi.size();
    vector<ll>pref(novon);
    pref[0]=dan[0].se;
    for(i=1;i<novon;i++)
    {
        pref[i]=pref[i-1]+novi[i].se;
    }
    while(q--)
    {
        cin >> x;
        l=0;
        r=novon-1;
        while(l<=r)
        {
            mid=(l+r)/2;
            if(novi[mid].fi>x)
            {
                r=mid-1;
            }
            else
            {
                l=mid+1;
            }
        }
        if(l==0)
        {
            cout << "0" << endl;
            continue;
        }
        l--;
        res=0;
        if(l>0)
        {
            res=pref[l-1];
        }
       // cout << l << endl;
        res+=min(novi[l].se,x-novi[l].fi+1);
        cout << res << endl;

    }



}


/*
4 1
30 3
34 2
41 2
44 4
41
*/


int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll t=1;
   // cin >> t;
    while(t--)
    {
        solve();
    }
}