#include <bits/stdc++.h>
using namespace std;
int ara[1000009];
int main() {
  int i, j, k, l, n, m, x, y, q;
  while (scanf("%d%d", &n, &m) == 2) {
    for (l = 0, i = 1; i <= n; i++) {
      scanf("%d%d", &x, &y);
      l += (x * y);
      ara[i] = l;
    }
    ara[n + 1] = 1000000009;
    for (k = 0, i = 0; i < m; i++) {
      scanf("%d", &q);
      for (j = k;; j++) {
        if (q <= ara[j] && q > ara[j - 1]) {
          printf("%d\n", j);
          j--;
          k = j;
          break;
        }
      }
    }
  }
  return 0;
}
