#include <bits/stdc++.h>
using namespace std;
const int MX = 200010;
int N, M, k, x;
int arr[MX];
int main() {
  scanf("%d%d", &N, &M);
  int p = 0, n = 0;
  for (int i = 1; i <= N; i++) {
    int a, b;
    scanf("%d%d", &a, &b);
    arr[i] = a * b;
    arr[i] += arr[i - 1];
  }
  while (M--) {
    int a;
    scanf("%d", &a);
    int lo = 1, hi = N, R = -1;
    while (lo <= hi) {
      int mid = (lo + hi) >> 1;
      if (arr[mid] >= a) {
        hi = mid - 1;
        R = mid;
      } else
        lo = mid + 1;
    }
    if (R == -1) R = N;
    cout << R << '\n';
  }
  return 0;
}
