#include <bits/stdc++.h>
using namespace std;
int main() {
  long long t = 1;
  while (t--) {
    long long n, m;
    cin >> n >> m;
    vector<long long> c(n), t(n);
    for (long long i = 0; i < n; ++i) cin >> c[i] >> t[i];
    vector<long long> v(m);
    for (auto &i : v) cin >> i;
    vector<long long> temp(n + 1);
    temp[0] = 0;
    for (long long i = 1; i <= n; ++i) {
      temp[i] = temp[i - 1] + (t[i - 1] * c[i - 1]);
    }
    for (long long i = 0; i < m; ++i) {
      long long l = 0, r = n, ans = 0;
      while (l <= r) {
        long long mid = l + (r - l) / 2;
        if (temp[mid] < v[i]) {
          ans = mid;
          l = mid + 1;
        } else
          r = mid - 1;
      }
      cout << ans + 1 << endl;
    }
  }
}
