#include <bits/stdc++.h>
using namespace std;
int RES[100005];
int main() {
  int N, M;
  cin >> N >> M;
  RES[0] = 0;
  for (int i = 1; i <= N; i++) {
    int a, b;
    cin >> a >> b;
    RES[i] = RES[i - 1] + (a * b);
  }
  int prev = 1;
  for (int i = 1; i <= M; i++) {
    int t;
    cin >> t;
    while (RES[prev] < t && prev <= N) prev++;
    cout << prev << endl;
  }
  return 0;
}
