#include <bits/stdc++.h>
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

using namespace std;
using ll = long long;

ll binarnaPrvoJavljanje(vector<pair<ll,ll> > v, ll X)
{
    ll L = 0;
    ll R = v.size() - 1;
    ll S;

    while(L <= R)
    {
        S = L + (R - L)/2;
        if((S == 0 || v[S - 1].second < X) && v[S].second >= X)
            return S;
        else if(X > v[S].second)
            L = S + 1;
        else
            R = S - 1;
    }
    return -1;
}

int main()
{
    fast;
    ll n, q;
    cin >> n >> q;
    vector<pair<ll, ll> > v;
    ll maksimalna_kolicina = 0;

    ll dan, broj;
    cin >> dan >> broj;
    v.push_back(make_pair(dan, dan + broj - 1));
    maksimalna_kolicina += broj;

    for(int i = 1; i < n; i++)
    {
        cin >> dan >> broj;

        if(v.back().second >= dan) v.back().second  += broj;
        else v.push_back(make_pair(dan, dan + broj - 1));
        maksimalna_kolicina += broj;
    }

//    for(int i = 0; i < v.size(); i++)
//    {
//        cout << v[i].first << " " << v[i].second << "\n";
//    }

    while(q--)
    {
        ll x;
        cin >> x;

        ll indeks = binarnaPrvoJavljanje(v, x);
//        cout << "Indeks: " << indeks << "\n";
        if(x < v[0].first) cout << 0 << "\n";
        else if (indeks == -1) cout << maksimalna_kolicina << "\n";
        else
        {
            ll answer = 0;
            for(ll i = 0; i <= indeks; i++)
            {
                if(i != indeks)
                {
                    answer += v[i].second - v[i].first + 1;
                }
                else
                {
                    answer += min(x, v[i].second) - v[i].first + 1;
                }
            }
            cout << answer << "\n";
        }

    }
    return 0;
}