#include <bits/stdc++.h>
using namespace std;

int findLargestSmallerIndex(const vector<long long>& arr, long long x) {
    int left = 0, right = arr.size() - 1;
    int result = -1;

    while (left <= right) {
        int mid = left + (right - left) / 2;
        if (arr[mid] < x) {
            result = mid;
            left = mid + 1;
        } else {
            right = mid - 1;
        }
    }
    return result;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int N, Q;
    cin >> N >> Q;
    
    vector<pair<pair<long long, long long>, long long>> trojke;
    vector<long long> dani;
    long long d1, d2 = 0, d22;

    for (int i = 0; i < N; i++) {
        long long tmp1, tmp2;
        cin >> tmp1 >> tmp2;
        if (i == 0) {
            d1 = tmp1;
            d2 = tmp2;
            d22 = tmp2;
        } else {
            trojke.push_back(make_pair(make_pair(tmp1 - 1, d2), tmp2));
            dani.push_back(tmp1 - 1);
            d2 += tmp2;
        }
    }

    for (int i = 0; i < Q; i++) {
        int q;
        cin >> q;

        if (q < d1) {
            cout << 0 << "\n";
        } else {
            int index = findLargestSmallerIndex(dani, q);
            if (index == -1) {
                cout << min(d22, q - d1 + 1) << "\n";
            } else {
                cout << trojke[index].first.second + min(q - trojke[index].first.first, trojke[index].second) << "\n";
            }
        }
    }

    return 0;
}