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