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