#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 7;
int n, m;
long long int sum[maxn];
vector<pair<long long int, long long int> > v;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m;
  sum[0] = 0;
  v.push_back({0, 0});
  for (int i = 1; i <= n; ++i) {
    long long int a, b;
    cin >> a >> b;
    v.push_back({a, b});
    sum[i] = sum[i - 1] + a * b;
  }
  int cnt = 0;
  while (m--) {
    long long int x;
    cin >> x;
    int ini = 1, fim = n;
    while (ini <= fim) {
      int mid = (ini + fim) / 2;
      long long int l = sum[mid] - v[mid].second * v[mid].first;
      long long int r = sum[mid];
      if (l < x && x <= r) {
        cnt = mid;
        break;
      }
      if (x <= l)
        fim = mid - 1;
      else
        ini = mid + 1;
    }
    cout << cnt << "\n";
  }
}
