#include <bits/stdc++.h>
const int MAXN = 100005;
int t[MAXN];
int n, m, p;
int main() {
  int i, c, tt;
  memset(t, 0, sizeof(t));
  scanf("%d %d", &n, &m);
  for (i = 1; i <= n; i++) {
    scanf("%d %d", &c, &tt);
    t[i] = t[i - 1] + c * tt;
  }
  p = 1;
  for (i = 0; i < m; i++) {
    scanf("%d", &tt);
    while (tt > t[p]) p++;
    printf("%d\n", p);
  }
  return 0;
}
