#include <bits/stdc++.h>
int c[100001], t[100001];
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  for (int i = 0; i < n; i++) cin >> c[i] >> t[i];
  int end = 0, now = -1;
  for (int i = 0; i < m; i++) {
    int moment;
    cin >> moment;
    while (moment > end) {
      end += c[now + 1] * t[now + 1];
      now++;
    }
    cout << now + 1 << endl;
  }
  return 0;
}
