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

void resi(vector<pair<long long, int>> v, long long a, int n){
    long long b;
    long long c = 0;
    for(int i = 0; i < n; ++i){
        if(v[i].first > a) break;
        b = v[i].first + v[i].second - 1;
        if(b > a){
            c += a - v[i].first + 1;
            break;
        }
        c += v[i].second;
    }
    cout << c << endl;
    return;
}
int main() {
    ios_base::sync_with_stdio(false); cin.tie(0);
    
    int n, q;
    cin >> n >> q;
    vector<pair<long long, int>> v(n);
    vector<long long> v1(q);
    
    for(int i = 0; i < n; ++i) cin >> v[i].first >> v[i].second;
    for(int i = 0; i < n; ++i) cin >> v1[i];
    
    for(int i = 0; i < q; ++i){
        resi(v, v1[i], n);
    }
    return 0;
}