#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  int N, M;
  cin >> N >> M;
  using Interval = pair<int, int>;
  vector<Interval> intervals(N);
  for (int i = 0; i < N; i++) {
    cin >> intervals[i].first >> intervals[i].second;
  }
  int i = 0;
  int current_time = 1;
  for (int m = 0; m < M; m++) {
    int moment;
    cin >> moment;
    while (i < N && moment > current_time +
                                 intervals[i].first * intervals[i].second - 1) {
      current_time += intervals[i].first * intervals[i].second;
      i++;
    }
    assert(i < N);
    cout << i + 1 << "\n";
  }
  return 0;
}
