#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  vector<pair<int, int> > a;
  a.push_back(make_pair(0, 0));
  for (int i = 0; i < n; i++) {
    int x, y, z = a.back().second;
    scanf("%d%d", &x, &y);
    a.push_back(make_pair(z + 1, z + x * y));
  }
  int ans = 1;
  while (m--) {
    int x;
    scanf("%d", &x);
    while (a[ans].second < x) ans++;
    printf("%d\n", ans);
  }
  return 0;
}
