#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int t = 1;
  while (t--) {
    long long int i, j, k = 0, n, m;
    cin >> n >> m;
    vector<long long int> a(n);
    for (i = 0; i < n; i++) {
      long long int x, y;
      cin >> x >> y;
      k += x * y;
      a[i] = k;
    }
    while (m--) {
      cin >> k;
      cout << (lower_bound(a.begin(), a.end(), k) - a.begin() + 1) << "\n";
    }
  }
  return 0;
}
