#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  int* c = new int[n];
  int* t = new int[n];
  int* T = new int[n];
  for (int i = 0; i < n; i++) cin >> c[i] >> t[i];
  T[0] = c[0] * t[0];
  for (int i = 1; i < n; i++) T[i] = T[i - 1] + c[i] * t[i];
  int pos = 0;
  for (int i = 0; i < m; i++) {
    int m;
    cin >> m;
    for (int i = pos; i < n; i++) {
      if (m == T[i]) {
        cout << i + 1 << endl;
        pos = i;
        break;
      } else if (m < T[0]) {
        cout << 1 << endl;
        pos = 0;
        break;
      } else if (m < T[i] && m > T[i - 1]) {
        cout << i + 1 << endl;
        pos = i;
        break;
      }
    }
  }
}
