#include <bits/stdc++.h>
using namespace std;
long long i, j, k, l, m, n, p, t, a, b, c, x, y, arr[200010], arr1[200010];
long long bsrch(long long k) {
  long long mid, lo = 0, hi = n - 1, s = 0;
  while (lo <= hi) {
    mid = (lo + hi) / 2;
    if (arr[mid] == k) {
      return mid + 1;
    }
    if (arr[mid] > k) {
      s = mid + 1;
      hi = mid - 1;
    } else if (arr[mid] < k)
      lo = mid + 1;
  }
  return s;
}
int main() {
  cin >> n >> m;
  for (i = 0; i < n; i++) {
    cin >> x >> y;
    if (i == 0)
      arr[i] = x * y;
    else {
      arr[i] = arr[i - 1] + (x * y);
    }
  }
  j = 0;
  for (i = 0; i < m; i++) {
    cin >> x;
    cout << bsrch(x) << "\n";
  }
}
