#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, i;
  cin >> n >> m;
  vector<long long int> time;
  long long int c, t, sum = 0;
  for (i = 0; i < n; i++) {
    cin >> c >> t;
    sum = sum + c * t;
    time.push_back(sum);
  }
  long long int v;
  vector<long long int>::iterator it;
  for (i = 0; i < m; i++) {
    cin >> v;
    it = lower_bound(time.begin(), time.end(), v);
    int h = it - time.begin();
    cout << h + 1 << endl;
  }
}
