#include <bits/stdc++.h>
using namespace std;
const int maxn = 100005;
int sum[maxn];
int binary_search(int l, int r, int v) {
  int mid = (l + r) >> 1;
  if (l == r) return l;
  if (v > sum[mid])
    return binary_search(mid + 1, r, v);
  else
    return binary_search(l, mid, v);
}
int main() {
  int n, m, c, t, v;
  while (scanf("%d%d", &n, &m) != EOF) {
    memset(sum, 0, sizeof(sum));
    for (int i = 1; i <= n; i++) {
      scanf("%d %d", &c, &t);
      sum[i] = sum[i - 1] + c * t;
    }
    while (m--) {
      scanf("%d", &v);
      printf("%d\n", binary_search(1, n, v));
    }
  }
  return 0;
}
