#include <bits/stdc++.h>
using namespace std;
int main() {
  int i, j, n, m, ci, ti;
  vector<int> mi;
  vector<int>::iterator itr;
  cin >> n >> m;
  mi.resize(n);
  for (i = 0; i < n; i++) {
    cin >> ci >> ti;
    if (i)
      mi[i] = mi[i - 1] + ti * ci;
    else
      mi[i] = ti * ci;
  }
  for (i = 0; i < m; i++) {
    cin >> ti;
    itr = lower_bound(mi.begin(), mi.end(), ti);
    cout << (itr - mi.begin()) + 1 << endl;
  }
  return 0;
}
