#include <bits/stdc++.h>
using namespace std;
int x[100000];
int main() {
  int i, m, n, c, t;
  scanf("%d%d", &n, &m);
  for (i = 0; i < n; i++) {
    scanf("%d%d", &c, &t);
    x[i] = (c * t) + x[i - 1];
  }
  for (i = 0; i < m; i++) {
    scanf("%d", &c);
    int *a = lower_bound(x, x + n, c);
    cout << a + 1 - x << endl;
  }
  return 0;
}
