#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, m, c, t;
  cin >> n >> m;
  vector<long long> a;
  a.resize(n);
  cin >> c >> t;
  a[0] = c * t;
  for (long long i = 1; i < n; i++) {
    cin >> c >> t;
    a[i] = a[i - 1] + (c * t);
  }
  long long j = 0;
  for (long long i = 0; i < m; i++) {
    cin >> c;
    for (; j < n; j++) {
      if (c <= a[j]) break;
    }
    cout << j + 1 << "\n";
  }
  return 0;
}
