#include <bits/stdc++.h>
using namespace std;
const long long N = 2e5 + 7;
long long n, m, a, b, cnt;
vector<int> v;
int main() {
  ios_base::sync_with_stdio(NULL);
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    cin >> a >> b;
    cnt += a * b;
    v.push_back(cnt);
  }
  for (int i = 0; i < m; i++) {
    cin >> a;
    cout << lower_bound(v.begin(), v.end(), a) - v.begin() + 1 << endl;
  }
}
