#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  int c[n], t[n], v[m];
  map<int, int> ma;
  int start = 0;
  for (int i = 0; i < n; i++) {
    cin >> c[i] >> t[i];
    ma[i] = (start + c[i] * t[i]);
    start = ma[i];
  }
  for (int i = 0; i < m; i++) {
    cin >> v[i];
  }
  int index = 0, i = 0;
  while (index < m && i < n) {
    if (ma[i] >= v[index]) {
      cout << i + 1 << endl;
      index++;
    } else {
      i++;
    }
  }
  return 0;
}
