#include <bits/stdc++.h>
using namespace std;
long long k, i, n, m, a[100001], b[100001], c[100001], z, x;
int main() {
  cin >> n >> m;
  for (i = 0; i < n; i++) {
    cin >> a[i] >> b[i];
    c[i] = a[i] * b[i];
  }
  for (i = 0; i < m; i++) {
    cin >> k;
    while (k > z) {
      z = z + c[x];
      x++;
    }
    cout << x << endl;
  }
}
