#include <iostream>
#include <bits/stdc++.h>

using namespace std;

#define endl "\n"
#define ll long long

int main()
{
    ios_base::sync_with_stdio(false);cin.tie(NULL);
    int n, q;
    cin >> n >> q;
    vector<ll> d;
    d.push_back(0);
    vector<ll> p;
    p.push_back(0);
    vector<pair<ll, ll>> ps(n+1, {0, 0});
    for(int i=0; i<n; i++){
        ll dn, pr;
        cin >> dn >> pr;
        d.push_back(dn);
        p.push_back(pr);
    }
    for(int i=1; i<=n; i++){
        ps[i].first=ps[i-1].first+min(ps[i-1].second, d[i]-d[i-1]-1);
        if(p[i]){
            p[i]--;
            ps[i].first++;
        }
        ps[i].second = max(0LL, ps[i-1].second-(d[i]-d[i-1]-1))+p[i];
    }
    while(q--){
        ll j;
        cin >> j;
        int ind = upper_bound(d.begin(), d.end(), j)-d.begin();
        ind--;
        cout << ps[ind].first + min(ps[ind].second, j-d[ind]) << endl;
    }
}