#include <bits/stdc++.h>
using namespace std;
int bs(int arr[], int n, int target) {
  int left = 0, mid, right = n - 1;
  while (left <= right) {
    mid = left + (right - left) / 2;
    if (arr[mid] < target)
      left = mid + 1;
    else
      right = mid - 1;
  }
  return left + 1;
}
int main() {
  int n, m;
  cin >> n >> m;
  int songs[n];
  int c, t, sum = 0;
  for (int i = 0; i < n; i++) {
    cin >> c >> t;
    sum += (c * t);
    songs[i] = sum;
  }
  int query;
  while (m--) {
    cin >> query;
    cout << bs(songs, n, query) << "\n";
  }
  return 0;
}
