#include <bits/stdc++.h>
using namespace std;
int a[100010] = {0};
int main() {
  int i, j, v, c, t, m, n;
  scanf("%d%d", &n, &m);
  for (i = 1; i <= n; i++) {
    scanf("%d%d", &c, &t);
    a[i] = a[i - 1] + c * t;
  }
  j = 0;
  for (i = 1; i <= m; i++) {
    scanf("%d", &v);
    while (v > a[j]) j++;
    printf("%d\n", j);
  }
}
