#include <bits/stdc++.h>
using namespace std;
long long tt[100010];
int main() {
  long long n, m;
  cin >> n >> m;
  for (long long i = 1; i <= n; i++) {
    long long c, t;
    cin >> c >> t;
    tt[i] = c * t;
    tt[i] += tt[i - 1];
  }
  long long I = 1;
  for (long long i = 1; i <= m; i++) {
    long long v;
    cin >> v;
    while (tt[I] < v) I++;
    cout << I << '\n';
  }
  return 0;
}
