#include <bits/stdc++.h>
using namespace std;
int n, m;
unsigned long long c[100005], t[100005], total[100005];
void solve() {
  memset(total, 0, sizeof(total));
  for (int i = 1; i <= n; i++) {
    total[i] = total[i - 1] + c[i] * t[i];
  }
  unsigned long long v;
  int idx = 0;
  for (int i = 0; i < m; i++) {
    cin >> v;
    while (total[idx] < v && idx <= n) {
      idx++;
    }
    printf("%d\n", idx);
  }
  return;
}
int main() {
  cin >> n >> m;
  memset(c, 0, sizeof(c));
  memset(t, 0, sizeof(t));
  for (int i = 1; i <= n; i++) {
    cin >> c[i] >> t[i];
  }
  solve();
  return 0;
}
