#include <bits/stdc++.h>
using namespace std;
using lli = long long int;
const int MOD = 1000000007;
const int MOD1 = 998244353;
const int maxn = 100010;
const int lim = (int)1e9;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n = 0, m = 0, c = 0, t = 0, x = 0;
  cin >> n >> m;
  vector<int> pre(n);
  for (int i = 0; i < n; ++i) {
    cin >> c >> t;
    pre[i] = c * t;
  }
  int pos = 0, sum = 0;
  while (m--) {
    cin >> x;
    while (x > sum) sum += pre[pos++];
    cout << pos << "\n";
  }
}
