#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  long long m, n, c, d, i, j, k, x, y, z, l, q, r;
  string s, s1, s2, s3, s4;
  long long cnt = 0, ans = 0, sum = 0;
  cin >> n >> m;
  long long a[n + 1], b[n + 1], cmsm[n + 1];
  memset(cmsm, 0, sizeof(cmsm));
  for (long long i = 1; i <= n; i++) cin >> a[i] >> b[i];
  for (long long i = 1; i <= n; i++)
    b[i] = a[i] * b[i], cmsm[i] = cmsm[i - 1] + b[i];
  vector<long long> v;
  for (long long i = 1; i <= n; i++) v.push_back(cmsm[i]);
  for (long long i = 0; i < m; i++) {
    cin >> x;
    ans = lower_bound(v.begin(), v.end(), x) - v.begin();
    cout << ans + 1 << endl;
  }
  return 0;
}
