#include <bits/stdc++.h>
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()

using namespace std;

using i64 = long long;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    int n, q;
    cin >> n >> q;

    vector<i64> v;
    map<i64, i64> m;
    map<i64, i64> eat;
    for(int i = 0;i < n;i++){
        i64 d, p;

        cin >> d >> p;
        m[d] += p - 1;
        v.push_back(d);
    }
    i64 sum = 0;
    for(int i = 0;i < n;i++){
        i64 og = m[v[i]];
        m[v[i]] += sum;
        eat[v[i]] += 1;
        sum += og;
        if(i + 1 < n){
            i64 ok = v[i + 1] - v[i] - 1;
            eat[v[i + 1]] += min(sum, ok) + eat[v[i]];
            sum = max(0LL, sum - ok);
        }
    }

    while(q--){
        i64 k;
        cin >> k;

        int low = 0, high = n - 1;
        int res = -1;
        while(low <= high){
            int mid = (low + high) / 2;

            if(v[mid] <= k){
                res = mid;
                low = mid + 1;
            }else{
                high = mid - 1;
            }
        }

        if(res == -1){
            cout << 0 << "\n";
        }else{
            i64 ostalo = k - v[res];

            i64 kurac = eat[v[res]] + m[v[res]];

            cout << min(kurac, eat[v[res]] + ostalo) << "\n";
        }
    }
}