#include <bits/stdc++.h>
using namespace std;
long long n, m, i, j, k, a1, a2, a3, a4, res, ans, sum;
bool k1, k2, k3;
long long l, r, M;
string s, q, s1, s2;
long long a[5000000];
int main() {
  cin >> n >> a4;
  for (i = 1; i <= n; i++) cin >> a1 >> a2, a[i] = a1 * a2;
  for (i = 2; i <= n; i++) a[i] += a[i - 1];
  for (i = 1; i <= a4; i++) {
    cin >> j;
    l = 1;
    r = n;
    while (l + 1 < r) {
      m = (l + r) / 2;
      if (a[m] >= j)
        r = m;
      else
        l = m + 1;
    }
    if (a[l] >= j)
      cout << l << endl;
    else
      cout << r << endl;
  }
}
