#include <bits/stdc++.h>
using namespace std;
int A[100005];
void solve(int n, int q) {
  int c, t;
  for (int i = 1; i <= n; ++i) scanf("%d %d", &c, &t), A[i] = A[i - 1] + c * t;
  while (q--) {
    scanf("%d", &t);
    printf("%d\n", lower_bound(A, A + n + 1, t) - A);
  }
}
int main() {
  int n, m;
  scanf("%d %d", &n, &m);
  solve(n, m);
  return 0;
}
