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