#include <bits/stdc++.h>
using namespace std;
template <class T>
inline T sqr(const T& x) {
  return x * x;
}
template <class T>
inline void updmax(T& a, const T& b) {
  if (b < a) a = b;
}
template <class T>
inline void updMax(T& a, const T& b) {
  if (b > a) a = b;
}
const long long maxn = 1000000;
const long long inf = -1000000001;
int n, m;
int c[maxn], t[maxn];
int main() {
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    cin >> c[i] >> t[i];
  }
  int j = 0;
  int passed = 0;
  for (int i = 0; i < m; i++) {
    int x;
    cin >> x;
    while (x > passed + c[j] * t[j]) {
      passed += c[j] * t[j];
      j++;
    }
    cout << j + 1 << "\n";
  }
  return 0;
}
