#include <bits/stdc++.h>
using namespace std;
class Reader {
  char buf[524288], b;
  int bi, bz;

 public:
  Reader() {
    bi = bz = 0;
    read();
  }
  void read() {
    if (bi == bz) {
      bi = 0;
      bz = fread(buf, 1, 524288, stdin);
    }
    b = bz ? buf[bi++] : 0;
  }
  void skip() {
    while (b > 0 && b <= 32) read();
  }
  unsigned int nextUnsignedInt() {
    unsigned int v = 0;
    for (skip(); b > 32; read()) v = v * 10 + b - 48;
    return v;
  }
};
int arr[100100];
int n, m;
int main() {
  Reader in;
  int i, c, t, time = 0, idx;
  n = in.nextUnsignedInt();
  m = in.nextUnsignedInt();
  for (i = 0; i < n; i++) {
    c = in.nextUnsignedInt();
    t = in.nextUnsignedInt();
    time += t * c;
    arr[i] = time;
  }
  i = 0;
  while (m--) {
    time = in.nextUnsignedInt();
    for (; arr[i] < time; i++)
      ;
    printf("%d\n", i + 1);
  }
  return 0;
}
