#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int n, m;
  cin >> n >> m;
  long long int music[n];
  for (long long int i = 0; i < n; i++) {
    long long int a, b;
    cin >> a >> b;
    music[i] = (a * b);
  }
  long long int cum[n];
  cum[0] = music[0];
  for (long long int i = 1; i < n; i++) cum[i] = cum[i - 1] + music[i];
  for (long long int i = 0; i < m; i++) {
    long long int query;
    cin >> query;
    auto upper = upper_bound(cum, cum + n, query);
    long long int index = (upper - cum);
    if (index == 0) {
      cout << "1"
           << "\n";
      continue;
    }
    if (cum[index - 1] == query)
      cout << index << "\n";
    else
      cout << (index + 1) << "\n";
  }
  return 0;
}
