#include <bits/stdc++.h>
using namespace std;
const long double EPS = 1e-9;
const int INF = (int)1e9;
const int N = (int)1e5 + 5;
int a[N];
int n;
int fnd(int x) {
  int l = 0, r = n;
  while (r - l > 1) {
    int i = (l + r) / 2;
    int cl = i == 0 ? 0 : a[i - 1] + 1;
    int cr = a[i];
    if (x >= cl && x <= cr) return i;
    if (x < cl)
      r = i;
    else
      l = i;
  }
  int i = (l + r) / 2;
  int cl = i == 0 ? 0 : a[i - 1] + 1;
  int cr = a[i];
  if (x >= cl && x <= cr) return i;
}
int main() {
  int m, c, t;
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    cin >> c >> t;
    a[i] = c * t;
    if (i > 0) a[i] += a[i - 1];
  }
  int v;
  for (int i = 0; i < m; i++) {
    cin >> v;
    cout << fnd(v) + 1 << endl;
  }
  return 0;
}
