#include <bits/stdc++.h>
int n, m, last, c, t, i, l, r, mid, v[100009];
using namespace std;
struct node {
  int l, r;
} d[100009];
int main() {
  scanf("%d%d", &n, &m);
  last = 0;
  for (i = 1; i <= n; i++) {
    scanf("%d%d", &c, &t);
    d[i].l = last + 1;
    d[i].r = last + c * t;
    last += c * t;
  }
  last = 1;
  for (i = 1; i <= m; i++) {
    scanf("%d", &v[i]);
    l = last;
    r = n;
    mid = (l + r) / 2;
    while (l <= r) {
      if (d[mid].l <= v[i] && d[mid].r >= v[i])
        break;
      else if (d[mid].l > v[i])
        r = mid - 1;
      else
        l = mid + 1;
      mid = (l + r) / 2;
    }
    printf("%d\n", mid);
    last = mid;
  }
  return 0;
}
