#include <bits/stdc++.h>
using namespace std;
int arr[100000];
int bs(int n, int val) {
  int start = 1;
  int endd = n;
  int mid;
  while (start < endd) {
    mid = start + (endd - start) / 2;
    if (val > arr[mid - 1]) {
      start = mid + 1;
    } else if (val < arr[mid - 1]) {
      endd = mid - 1;
    } else {
      return mid;
    }
  }
  if (val > arr[start - 1]) {
    return start + 1;
  } else {
    return start;
  }
}
int main() {
  int n, m, x, y, val;
  cin >> n >> m;
  int res[m];
  cin >> x >> y;
  arr[0] = x * y;
  for (int i = 1; i < n; i++) {
    cin >> x >> y;
    arr[i] = x * y + arr[i - 1];
  }
  for (int i = 0; i < m; i++) {
    cin >> val;
    res[i] = bs(n, val);
  }
  for (int i = 0; i < m; i++) {
    cout << res[i] << endl;
  }
  return 0;
}
