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