#include <bits/stdc++.h>
using namespace std;
const int N = 100001;
int t[N], n, m;
int main() {
  scanf("%d%d", &n, &m);
  int x, y;
  for (int i = 1; i <= n; i++) scanf("%d%d", &x, &y), t[i] = x * y;
  int tmp = t[1], j = 1;
  for (int i = 1; i <= m; i++) {
    scanf("%d", &x);
    while (tmp < x) tmp += t[++j];
    printf("%d\n", j);
  }
}
