#include <bits/stdc++.h>

using namespace std;

vector<pair<unsigned long long, unsigned long long> > a;
vector<unsigned long long> sums;
unsigned long long buff;
int n, q;

void stampaj(unsigned long long buff)
{
    for(int i = 0; i < a.size(); i++)
    {
        cout << a[i].first << " ";
    }
    cout << endl;
    for(int i = 0; i < a.size(); i++)
    {
        cout << a[i].second << " ";
    }
    cout << endl;
    for(int i = 0; i < sums.size(); i++)
    {
        cout << sums[i] << " ";
    }
    cout << buff << endl;
}

bool uporedi_me(const long long k, const pair<long long, long long>& p) {
    return k < p.first;
}

void upit(long long k) {
    if(k < a[0].first)
    {
        cout << 0 << endl ;
    }
    else if(k > a[n-1].first)
    {
        cout << sums[n-1] + min(buff, k - a[n-1].first + 1) << endl;
    }
    else
    {
        int j = upper_bound(a.begin(), a.end(), k, uporedi_me) - a.begin();
        if(j == n)
        {
            cout << sums[n-1] + 1 << endl;
        }
        else
        {
            cout << sums[j-1] + min(buff, k - a[j-1].first +1) << endl;
        }
    }

}

void solve(int n, int q)
{
    unsigned long long d, p, k;
    cin >> d >> p;
    a.push_back(make_pair(d, p));
    sums.push_back(0);
    buff = p;
    for(int i = 1; i < n; i++)
    {
        cin >> d >> p;
        a.push_back(make_pair(d, p));
        sums.push_back(sums[i-1] + min(buff, d-a[i-1].first));
        buff -= min(buff, d-a[i-1].first);
        buff += p;
        //cout << buff << endl;
    }

    //stampaj(buff);

    while (q--)
    {
        cin >> k;
        upit(k);
    }
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    cin >> n >> q;
    solve(n, q);

    return 0;
}