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