#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long n, m, sum = 0, temp1, temp2, i, index, temp;
  vector<long long> v1;
  cin >> n >> m;
  for (i = 0; i < n; i++) {
    cin >> temp1 >> temp2;
    sum = sum + temp1 * temp2;
    v1.push_back(sum);
  }
  for (i = 0; i < m; i++) {
    cin >> temp;
    auto it = lower_bound(v1.begin(), v1.end(), temp);
    index = it - v1.begin();
    cout << index + 1 << endl;
  }
}
int main() {
  solve();
  return 0;
}
