#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, l, r, x, mid;
  cin >> n >> m;
  int a[n][2];
  for (int i = 0; i < n; i++) cin >> a[i][0] >> a[i][1];
  int b[m];
  for (int i = 0; i < m; i++) cin >> b[i];
  int music[n];
  for (int i = 0; i < n; i++) music[i] = 0;
  music[0] = a[0][0] * a[0][1];
  for (int i = 1; i < n; i++) music[i] = music[i - 1] + a[i][0] * a[i][1];
  for (int i = 0; i < m; i++) {
    x = b[i];
    l = -1;
    r = n - 1;
    while (r - l > 1) {
      mid = (l + r) / 2;
      if (x <= music[mid])
        r = mid;
      else
        l = mid;
    }
    cout << r + 1 << endl;
  }
  return 0;
}
