#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int n, m;
  cin >> n >> m;
  vector<long long int> prefix;
  long long int sum = 0;
  for (long long int i = 0; i < n; i++) {
    long long int c, t;
    cin >> c >> t;
    prefix.push_back(sum + c * t);
    sum += c * t;
  }
  while (m--) {
    long long int v;
    cin >> v;
    long long int l = 0;
    long long int r = n - 1;
    long long int index = (l + r) / 2;
    long long int prev = prefix[index - 1];
    if (index - 1 < 0) prev = -1;
    long long int cnt = 0;
    while (!(v > prev && v <= prefix[index])) {
      if (v > prefix[index])
        l = index + 1;
      else
        r = index - 1;
      index = (l + r) / 2;
      prev = prefix[index - 1];
      if (index - 1 < 0) prev = -1;
    }
    cout << (index + 1) << endl;
  }
}
