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