#include <bits/stdc++.h>
#pragma comment(linker, "/stack:336777216")
#pragma GCC optimize("O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
ll const mod = 1000000007;
ll n, k, s, m;
int main() {
  ios_base::sync_with_stdio(false), cin.tie(0);
  cin >> n >> m;
  vector<ll> v;
  while (n--) {
    ll c, t;
    cin >> c >> t;
    if (v.empty())
      v.push_back(c * t);
    else
      v.emplace_back(c * t + v.back());
  }
  while (m--) {
    ll m;
    cin >> m;
    auto it = lower_bound(v.begin(), v.end(), m);
    cout << (it - v.begin()) + 1 << '\n';
  }
  return 0;
}
