#include <bits/stdc++.h>
using namespace std;
int a[100005];
int main() {
  int n, m, i, j, sum;
  int c, t;
  while (scanf("%d%d", &n, &m) != EOF) {
    sum = 0;
    for (i = 1; i <= n; i++) {
      scanf("%d%d", &c, &t);
      sum += c * t;
      a[i] = sum;
    }
    a[0] = 0;
    j = 0;
    for (i = 1; i <= m; i++) {
      scanf("%d", &c);
      while (c > a[j]) {
        j++;
      }
      printf("%d\n", j);
      j--;
    }
  }
  return 0;
}
