#include <bits/stdc++.h>
using namespace std;
const int Maxn = int(1e5) + 256;
vector<int> v;
int n, m, sum;
int main() {
  ios_base ::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> m;
  for (int i = 1; i <= n; ++i) {
    int x, y;
    cin >> x >> y;
    sum += x * y;
    v.push_back(sum);
  }
  while (m--) {
    int x;
    cin >> x;
    cout << lower_bound(v.begin(), v.end(), x) - v.begin() + 1 << "\n";
  }
  return 0;
}
