#include <bits/stdc++.h>
using namespace std;
struct node {
  int a;
  int b;
  int sum;
};
int main() {
  int c[100001], t[100001], j, i, n, m, v[100001], s;
  cin >> n >> m;
  for (i = 1; i <= n; i++) cin >> c[i] >> t[i];
  s = c[1] * t[1];
  for (j = 1; j <= m; j++) cin >> v[j];
  int p = 1, q = 1;
  while (p <= n && q <= m) {
    if (v[q] <= s) {
      cout << p << endl;
      q++;
    } else {
      p++;
      s = s + c[p] * t[p];
    }
  }
  return 0;
}
