#include <bits/stdc++.h>
using namespace std;

int main(){

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int n, q; cin >> n >> q;
    vector<int64_t> d (n);
    for(int i=0; i<n; i++){
        int64_t direkt, otrov; cin >> direkt >> otrov;
        d[i] = direkt;
        if(i!=0) d[i] += d[i-1];
    }
    for(const auto& dir : d) cout << dir << ' ';
    cout << '\n';
    while(q--){
        int64_t helt; cin >> helt;
        int64_t id = lower_bound(d.begin(), d.end(), helt) - d.begin();
        if(id == n){
                cout << "-1\n";
                continue;
        }
        if(d[id]<helt) id++;
        while(id!=0 && d[id-1]==d[id]) id--;
        cout << id+1 << '\n';
    }



}