#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
void DBG() { cerr << "]" << endl; }
template<class H, class... T> void DBG(H h, T... t) { cerr << to_string(h); if(sizeof...(t)) cerr << ", "; DBG(t...);}
#define dbg(...) cerr << "[" << #__VA_ARGS__ << "]: [", DBG(__VA_ARGS__)

const int N = 2e5 + 3;
ll d[N], p[N], ans[N];
vector<int> need[N];
bool sigurno[N];

void solve() {
    int n, q; cin >> n >> q;
    ll sumpoison = 0, sumd = 0, sump = 0;
    for (int i = 1; i <= n; i++) {
        cin >> d[i] >> p[i];
        int low = i, high = n+1;
        while (low < high) {
            int mid = (low + high) / 2;
            if ((mid-i+1) * p[i] < d[i]) {
                low = mid+1;
            } else
                high = mid;
        }
        //dbg(i, low);
        if (low != n+1) {
            need[low].push_back(i);
        }
    }
    for (int i = 1; i <= n; i++) {
        sumd += d[i];

        for (auto j : need[i]) {
            sumd -= d[j];
            sump += (i-j+1) * p[j];
            sumpoison += p[j];
        }
        ans[i] = sumd + sump;
        sump += sumpoison;
        if (sigurno[i-1]) {
            sigurno[i] = true;
        } else if (ans[i] >= 1e9) {
            sigurno[i] = true;
        }
    }

    //dbg(dnula, pnula);
    while (q--) {
        int h; cin >> h;
        int low = 1, high = n+1;
        while (low < high) {
            int mid = (low + high) / 2;
            if (sigurno[mid] || ans[mid] >= h) {
                high = mid;
            } else
                low = mid+1;
        }
        if (low == n+1)
            low = -1;
        cout << low << "\n";
    }
}

signed main() {
    ios::sync_with_stdio(false); cin.tie(0);
    int t=1; //cin >> t;
    while (t--) {
        solve();
    }
}