#include <bits/stdc++.h>
using namespace std;
struct po {
  int x, id, st;
} a[444444];
int n, m, i, j, x, y, t, k, ans[111111], id;
bool cmp(po a, po b) {
  if (a.x == b.x) {
    return a.st < b.st;
  }
  return a.x < b.x;
}
int main() {
  cin >> n >> m;
  for (i = 1; i <= n; i++) {
    scanf("%d%d", &x, &y);
    a[++t].x = k + 1, a[t].id = i, a[t].st = 0;
    k += x * y;
  }
  for (i = 1; i <= m; i++) {
    scanf("%d", &x);
    a[++t].x = x, a[t].id = i, a[t].st = 1;
  }
  sort(a + 1, a + t + 1, &cmp);
  for (i = 1; i <= t; i++) {
    if (!a[i].st) {
      id = a[i].id;
    } else {
      ans[a[i].id] = id;
    }
  }
  for (i = 1; i <= m; i++) {
    printf("%d\n", ans[i]);
  }
  return 0;
}
