#include <bits/stdc++.h>
using namespace std;
long long n, m, c, t[111111], A;
set<pair<long long, int> > s;
int main() {
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    scanf("%I64d%64d", &c, &t[i]);
    s.insert(make_pair((c * t[i]) + A, i));
    A += (c * t[i]);
  }
  for (int i = 1; i <= m; i++) {
    scanf("%I64d", &c);
    set<pair<long long, int> >::iterator it = s.lower_bound(make_pair(c, 0));
    long long v = it->first, ind = it->second;
    cout << ind << endl;
  }
}
