#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  vector<int> songs(1, 0);
  for (int i = 0; i < n; i++) {
    int c, t;
    cin >> c >> t;
    songs.push_back(songs[i] + c * t);
  }
  int song = 1;
  while (m--) {
    int a;
    cin >> a;
    while (songs[song] < a) song++;
    cout << song << endl;
  }
  return 0;
}
