#include <bits/stdc++.h>
using namespace std;
int binser(int* arr, int n, int k) {
  int start = 0;
  int end = n - 1;
  while (start < end) {
    int mid = (start + end) / 2;
    if (arr[mid] == k) {
      return mid;
    } else if (arr[mid] > k) {
      end = mid;
    } else {
      start = mid + 1;
    }
  }
  return start;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n, m;
  cin >> n >> m;
  int arr[n];
  int sum = 0;
  for (int i = 0; i < n; i++) {
    int c, t;
    cin >> c >> t;
    sum += c * t;
    arr[i] = sum;
  }
  for (int i = 0; i < m; i++) {
    int ele;
    cin >> ele;
    cout << binser(arr, n, ele) + 1 << "\n";
  }
}
