#include <bits/stdc++.h>
using namespace std;
ifstream fin("INPUT.txt");
ofstream fout("OUTPUT.txt");
long long func(long long c, long long *time, long long n) {
  long long l = 0;
  long long r = n - 1;
  long long mid = (r + l) / 2;
  while (r > l) {
    if (c <= time[l]) return l;
    if (c > time[r - 1]) return r;
    if (c > time[mid])
      l = mid + 1;
    else
      r = mid;
    mid = (l + r) / 2;
  }
  return mid;
}
int main() {
  long long n, m;
  cin >> n >> m;
  long long *time = new long long[n];
  long long c, t;
  cin >> c >> t;
  time[0] = c * t;
  ;
  for (long long i = 1; i < n; i++) {
    cin >> c >> t;
    time[i] = c * t + time[i - 1];
  }
  for (long long i = 0; i < m; i++) {
    cin >> c;
    cout << func(c, time, n) + 1 << endl;
  }
  return 0;
}
