#include <bits/stdc++.h>
using namespace std;
int i, j, k, n, f, t, q, l, m;
int a[101000] = {0};
int main(void) {
  cin >> n >> m;
  j = 0;
  for (i = 0; i < n; i++) {
    int t, c;
    cin >> c >> t;
    a[j] = (j > 0 ? a[j - 1] : 0) + c * t;
    j++;
  }
  for (i = 0; i < m; i++) {
    int v;
    cin >> v;
    int* aa = lower_bound(a, a + j, v);
    cout << aa - a + 1 << endl;
  }
  return 0;
}
