#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, l, r, c;
  cin >> n >> m;
  vector<int> diap(n);
  cin >> l >> r;
  diap[0] = l * r;
  for (int i = 1; i < n; i++) {
    cin >> l >> r;
    diap[i] = diap[i - 1] + l * r;
  }
  int ind = 0;
  for (int i = 0; i < m; i++) {
    cin >> c;
    for (; ind < n; ind++) {
      if (diap[ind] >= c) {
        cout << ind + 1 << endl;
        break;
      }
    }
  }
  return 0;
}
