#include <bits/stdc++.h>
using namespace std;
const int MAXN = 200005;
const int inf = 2147483647;


int n, q, h;
long long d[MAXN], p[MAXN];
long long md[MAXN], inc;
pair<long long, long long> pp[MAXN];

void precalc(){
    for(int i = 0; i < n; ++i){
        if(p[i] == 0) continue;
        int t = max(1.0, ceil(1.0*d[i]/p[i]));
        int dan = i+t-1;
        if(dan > n) continue;
        pair<long long, long long> pppp = make_pair(p[i]*t-d[i], p[i]);
        pp[dan].first += pppp.first;
        pp[dan].second += pppp.second;
    }
    for(int i = 0; i < n; ++i){
        md[i+1] = md[i];
        md[i+1] += d[i] + inc + pp[i].first;
        inc += pp[i].second;
    }
    //cout << "pp:\n"; for(int i = 0; i < n; ++i) cout << pp[i].first << ' ' << pp[i].second << '\n';
    //cout << "md: ";for(int i = 0; i <= n; ++i){cout << md[i] << ' ';}cout << '\n';
}


void solve(){
    int t = lower_bound(md, md+n+1, h) - md;
    cout << (t == n+1 ? -1 : t) << '\n';
}

signed main(){
    ios_base::sync_with_stdio(0); cin.tie(0);
    cin >> n >> q;
    for(int i = 0; i < n; ++i){
        cin >> d[i] >> p[i];
    }
    precalc();
    while(q--){
        cin >> h;
        solve();
    }
    return 0;
}