#include <bits/stdc++.h>
using namespace std;
signed main() {
  long long int n, m;
  cin >> n >> m;
  vector<long long int> v(n, 0);
  for (long long int i = 0; i < n; i++) {
    long long int x, y;
    cin >> x >> y;
    v[i] = (x * y);
    if (i > 0) v[i] += v[i - 1];
  }
  while (m--) {
    long long int u;
    cin >> u;
    cout << (lower_bound(v.begin(), v.end(), u) - v.begin()) + 1 << "\n";
  }
}
