#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MAX = 1e5 + 100;
const ll inf = 1e9;
const ll mod = 998244353;
ll a[MAX], c[MAX], t[MAX];
string b[] = {"50", "25", "75", "00"};
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ll tc = 1, n, m, ans = 0, v, r;
  cin >> n >> m;
  for (ll i = 1; i < n + 1; i++) cin >> c[i] >> t[i];
  ll ini = 1, time = 0;
  while (m--) {
    cin >> v;
    while (v > time + c[ini] * t[ini]) time += c[ini] * t[ini], ini++;
    cout << ini << endl;
  }
  return 0;
}
