#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base ::sync_with_stdio(false);
  cin.tie(NULL);
  long long n, m;
  cin >> n >> m;
  long long c[n], t[n];
  for (long long i = 0; i < n; i++) cin >> c[i] >> t[i];
  long long v[m];
  for (long long i = 0; i < m; i++) cin >> v[i];
  long long a[n];
  long long k = 0;
  for (long long i = 0; i < n; i++) {
    a[i] = k + c[i] * t[i];
    k = a[i];
  }
  long long i = 0, j = 0;
  while (i < m) {
    if (a[j] >= v[i]) {
      cout << j + 1 << endl;
      i++;
    } else {
      j++;
    }
  }
}
