#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  vector<int> v;
  v.resize(n + 1);
  v[0] = 0;
  for (int i = 0, _n = (n); i < _n; i++) {
    int x, y;
    cin >> x >> y;
    v[i + 1] = v[i] + x * y;
  }
  int ix = 0;
  for (int i = 0, _n = (m); i < _n; i++) {
    int x;
    cin >> x;
    while (v[ix] < x) {
      ix++;
    }
    cout << ix << endl;
    ix--;
  }
}
