#include <algorithm>
#include <ios>
#include <iostream>

using namespace std;

int main(){
    ios_base::sync_with_stdio(false);
    int n, q;
    cin >> n >> q;
    long long a[n];
    long long b[n];
    for (int i = 0; i < n; i++) cin >> a[i] >> b[i];
    long long c[q];
    for (int i = 0; i < q; i++) cin >> c[i];

    for (int i = 0; i < q; i++) {
        int ix = lower_bound(a, a+n, c[i]) - a - 1;
        if (ix == -1) cout << 0 << '\n';
        else {
            long long s = 0;
            long long p = 0;
            for (int j = 0; j < ix; j++) {
                s+=b[j];
                if (a[j+1] - a[j] > s){
                    p += s;
                    s = 0;
                } else {
                    s-=a[j+1] - a[j];
                    p+=a[j+1] - a[j];
                }
            }
            s+=b[ix];
            if (c[i]-a[ix] > s) {
                p+=s;
                s = 0;
            } else {
                s-=c[i] - a[ix] - 1;
                p+=c[i] - a[ix] + 1;
            }
            cout << p << '\n';
        }
    }
}