#include <bits/stdc++.h>
using namespace std;
int main(){
    int n,q; cin >> n >> q;
    vector<pair<int, unsigned long long int>> a;
    pair<int, unsigned long long int> dp;
    for (int i=0; i<n; i++){
        cin >> dp.first >> dp.second;
        if (i==0) a.push_back(dp);
        else {
            if (a.back().second-1+a.back().first>=dp.first){
                a[a.size()-1].second+=dp.second;
            }
            else {
                a.push_back(dp);
            }
        }
    }
    vector<pair<unsigned long long int,unsigned long long int>> x(a.size());
    for (int i=0; i<a.size(); i++){
        x[i].first=a[i].first;
        x[i].second=a[i].first+a[i].second;
    }
    for (int i=0; i<q; i++){
        unsigned long long int k; cin >> k;
        if (k<x[0].first) cout << 0 << '\n';
        else if (k>=x[0].first && k<=x[0].second) cout << k-x[0].first+1 << '\n';
        else {
            unsigned long long int br=0;
            if (k>x[0].second) br+=a[0].second;
            for (int j=1; j<a.size(); j++){
                if (k<x[j].first) {
                    cout << br << '\n';
                    break;
                }
                else if (k>=x[j].first && k<=x[j].second) {
                    cout << k-x[j].first+1+br << '\n';
                    break;
                }
                else {
                    br+=a[j].second;
                }
            }
            if (k>x[a.size()-1].second) cout << br << '\n';
        }
    }
    return 0;
}
/*
4 4
5 7
14 1000000000
15 1000000000
16 1000000000
3
8
11
1000000000000000000
*/