#include <bits/stdc++.h>
using namespace std;
int cnt[100007];
int main() {
  int n, m;
  while (~scanf("%d%d", &n, &m)) {
    int fg = 0;
    for (int i = 1; i <= n; i++) {
      int a, b;
      scanf("%d%d", &a, &b);
      fg += a * b;
      cnt[i] = fg;
    }
    while (m--) {
      int t;
      scanf("%d", &t);
      int l = 1, r = n;
      while (l <= r) {
        int mid = (l + r) / 2;
        if (cnt[mid] >= t)
          r = mid - 1;
        else
          l = mid + 1;
      }
      printf("%d\n", l);
      ;
    }
  }
  return 0;
}
