#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

int main() 
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    ll n, q;
    cin >> n >> q;
    map<ll,ll> a;
    vector<ll> in;
    ll pom=0;
    for(ll i=0;i<n;i++) {
        ll d, p;
        cin >> d >> p;
       // a.resize(d+p);
        ll j;
        for(j=0;j<p;j++) {
            a[d+j-1] += j+1+pom;
        }
        pom += a[d+p-2];
        in.push_back(d+p-2);
    }
   /* for(int i=0;i<a.size();i++) {
        cout << a[i] << " ";
    }*/

    while(q>0) {
        ll x;
        cin >> x;
        if(a[x-1]!=0) cout << a[x-1] << "\n";
        else {
            auto it = lower_bound(in.begin(), in.end(), x);
            cout << a[*(it-1)] << "\n";
        }
        q--;
    }
    return 0;
}