#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
const long double E = 1e-7;
char ccc;
inline void read(int &n) {
  n = 0;
  while (true) {
    ccc = getchar();
    if (ccc == ' ' || ccc == '\n') break;
    n = n * 10 + ccc - '0';
  }
}
template <typename T>
inline T sqr(T t) {
  return t * t;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  srand(time(NULL));
  cout.precision(15);
  cout << fixed;
  int n, m;
  cin >> n >> m;
  int now = 0;
  set<pair<long long, long long> > s;
  for (int i = 1; i <= n; i++) {
    int a, b;
    cin >> a >> b;
    now += a * b;
    s.insert(make_pair(now, i));
  }
  while (m--) {
    int t;
    cin >> t;
    cout << (s.lower_bound(make_pair(t, INT_MIN))->second) << endl;
  }
}
