#include <bits/stdc++.h>
using namespace std;
int N, M, A[111111];
int main(int argc, char* argv[]) {
  scanf("%d%d", &N, &M);
  for (int i = 0; i < N; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    A[i + 1] = x * y + A[i];
  }
  while (M--) {
    int x;
    scanf("%d", &x);
    int l = 0, r = N;
    while (l < r) {
      int mid = (l + r) >> 1;
      if (A[mid] >= x) {
        r = mid;
      } else {
        l = mid + 1;
      }
    }
    printf("%d\n", l);
  }
  return 0;
}
