#include <bits/stdc++.h>
using namespace std;
vector<int> v;
int lowerbound(int l, int h, int ele) {
  int mid;
  while (h - l > 1) {
    mid = (l + h) / 2;
    if (ele <= v[mid])
      h = mid;
    else
      l = mid;
  }
  if (v[l] >= ele) return l;
  return h;
}
int main() {
  int n, m, i, j, k;
  scanf("%d", &n);
  scanf("%d", &m);
  for (i = 0; i < n; i++) {
    scanf("%d", &j);
    scanf("%d", &k);
    j *= k;
    if (i) j += v[i - 1];
    v.push_back(j);
  }
  for (i = 0; i < m; i++) {
    cin >> j;
    cout << lowerbound(0, n - 1, j) + 1 << endl;
  }
}
