#include <bits/stdc++.h>
using namespace std;
vector<long long> arr;
int lower_bound(int x) {
  int min = 0;
  int max = arr.size() - 1;
  while (min + 5 < max) {
    int med = (min + max) / 2;
    if (arr[med] < x)
      min = med + 1;
    else
      max = med;
  }
  int k = 0;
  long long menor = 1000000000000;
  for (int i = min; i <= max; i++) {
    if (arr[i] >= x) {
      if (arr[i] < menor) {
        menor = arr[i];
        k = i + 1;
      }
    }
  }
  return k;
}
int main() {
  ios::sync_with_stdio(false);
  int n, m;
  cin >> n >> m;
  long long suma = 0;
  for (int i = 0; i < n; i++) {
    long long t, k;
    cin >> t >> k;
    suma += t * k;
    arr.push_back(suma);
  }
  for (int i = 0; i < m; i++) {
    int t;
    cin >> t;
    cout << lower_bound(t) << endl;
  }
}
