#include<bits/stdc++.h>

using namespace std;

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

    long long n, q;
    cin >> n >> q;
    long long dani[n];
    long long preostalaPlazma[n];
    long long pojedenaPlazma[n];
    for(long long i = 0; i < n; i++)
    {
        cin >> dani[i];
        long long x; cin >> x;
        if(i == 0) 
        {
            preostalaPlazma[i] = x - 1;
            pojedenaPlazma[i] = 1;
        }
        else 
        {
            if(preostalaPlazma[i - 1] < dani[i] - dani[i - 1]) preostalaPlazma[i] = x;
            else preostalaPlazma[i] = preostalaPlazma[i - 1] - (dani[i] - dani[i - 1]) + x;
            
            if (dani[i] - preostalaPlazma[i - 1] > dani[i - 1]) 
            {
                pojedenaPlazma[i] = pojedenaPlazma[i - 1] + preostalaPlazma[i - 1];
                if(preostalaPlazma[i] > 0) pojedenaPlazma[i]++;
                preostalaPlazma[i]--;
            }
            else 
            {
                pojedenaPlazma[i] = pojedenaPlazma[i - 1] + (dani[i] - dani[i - 1]);
            }
        }
    }
    cout << "-------------------\n";
    for(long long i = 0; i < n; i++) 
        cout << "dani: " << dani[i] << " pojedenaPlazma: " << pojedenaPlazma[i] << " preostalaPlazma: " << preostalaPlazma[i] << endl; 
    cout << "----------" << endl;
    for(long long i = 0; i < q; i++)
    {
        long long x;
        cin >> x;
        long long l = 0, r = n - 1;
        long long res = -1;
        bool uboden = false;
        while (l <= r)
        {
            long long mid = l + (r - l) / 2;
            if(dani[mid] == x) 
            {
                res = mid;
                uboden = true;
                break;
            }
            else if(dani[mid] < x)
            {
                l = mid + 1;
                res = mid;
            }
            else r = mid - 1;
        }
        if(res == -1) cout << 0 << endl;
        else if(uboden) cout << pojedenaPlazma[res] << endl;
        else if(preostalaPlazma[res] + dani[res] < x) cout << pojedenaPlazma[res] + preostalaPlazma[res] << endl;
        else cout << pojedenaPlazma[res] + (x - dani[res]) << endl;
    }
    return 0;
}