#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, x, y;
  scanf("%d%d", &n, &m);
  vector<int> cum(n);
  for (int i = 0; i < n; ++i) {
    scanf("%d%d", &x, &y);
    cum[i] = x * y;
    if (i > 0) cum[i] += cum[i - 1];
  }
  for (int i = 0; i < m; ++i) {
    scanf("%d", &x);
    printf("%d\n", lower_bound(cum.begin(), cum.end(), x) - cum.begin() + 1);
  }
  return 0;
}
