#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  vector<int> a(n + 1);
  for (int i = 1; i <= n; ++i) {
    int c, t;
    cin >> c >> t;
    a[i] = a[i - 1] + c * t;
  }
  int song = 1;
  for (int i = 0; i < m; ++i) {
    int v;
    cin >> v;
    while (true) {
      if (a[song] >= v) {
        cout << song << endl;
        break;
      } else
        ++song;
    }
  }
  return 0;
}
