#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, c, t, i, ans;
  cin >> n >> m;
  vector<long long int> a;
  set<long long int> b;
  int q[m];
  int temp1 = 0, temp2 = 0;
  a.push_back(temp1);
  b.insert(temp1);
  for (i = 1; i <= n; i++) {
    scanf("%d", &c);
    scanf("%d", &t);
    temp1 = temp2 + t * c;
    temp2 = temp1;
    a.push_back(temp1);
    b.insert(temp1);
  }
  for (i = 0; i < m; i++) scanf("%d", &q[i]);
  for (i = 0; i < m; i++) {
    if (b.find(q[i]) != b.end()) {
      ans = (lower_bound(a.begin(), a.end(), q[i]) - a.begin());
    } else {
      ans = (upper_bound(a.begin(), a.end(), q[i]) - a.begin());
    }
    cout << ans << endl;
  }
  return 0;
}
