#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n, m;
  cin >> n >> m;
  vector<int> v(n);
  for (int i = 0; i < n; i++) {
    int c, t;
    cin >> c >> t;
    v[i] = c * t;
  }
  int init = 1;
  vector<int> ret;
  for (int i = 0; i < n; i++) {
    int end = init + v[i] - 1;
    ret.push_back(end);
    init = end + 1;
  }
  int j = 0, x;
  for (int i = 0; i < m; i++) {
    cin >> x;
    if (x > ret[j])
      while (x > ret[j]) j++;
    cout << j + 1 << endl;
  }
  return 0;
}
