#include <bits/stdc++.h>
using namespace std;
int main() {
  cin.tie(NULL);
  cout.tie(NULL);
  int n, m;
  scanf("%d%d", &n, &m);
  long long int c[n + 5], t[n + 5];
  unsigned long long int cnt = 0, os[n + 5];
  for (int i = 0; i < n; i++) {
    scanf("%lld%lld", &c[i], &t[i]);
    cnt += (c[i] * t[i]);
    os[i] = cnt;
  }
  int res = 0;
  long long int v;
  for (int i = 0; i < m; i++) {
    scanf("%lld", &v);
    res = lower_bound(os + res, os + n, v) - os;
    printf("%d\n", res + 1);
  }
  return 0;
}
