#include <bits/stdc++.h>
using namespace std;
set<pair<int, int> > s;
int main() {
  int n, m, c, t, x = 0;
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    cin >> c >> t;
    x += c * t;
    s.insert({x, i + 1});
  }
  for (int i = 0; i < m; i++) {
    cin >> x;
    cout << s.lower_bound({x, 0})->second << endl;
  }
}
