#include <bits/stdc++.h>
using namespace std;
map<int, long long> a;
map<int, long long> t;
vector<pair<long long, int> > priceList;
int main() {
  int n, m;
  cin >> n >> m;
  priceList.resize(n);
  for (int i = 1; i <= n; i++) {
    int ost;
    cin >> ost;
    a[i] = ost;
  }
  for (int i = 1; i <= n; i++) {
    int cost;
    cin >> cost;
    t[i] = cost;
    priceList[i - 1] = make_pair(cost, i);
  }
  sort(priceList.begin(), priceList.end());
  reverse(priceList.begin(), priceList.end());
  while (m--) {
    long long ans = 0;
    int tc, cnt;
    cin >> tc >> cnt;
    if (a.find(tc) != a.end()) {
      if (a[tc] < cnt)
        ans += a[tc] * t[tc], cnt -= a[tc], a[tc] = 0;
      else
        ans += t[tc] * cnt, a[tc] -= cnt, cnt = 0;
    }
    long long mn = 1;
    while (cnt != 0) {
      if (priceList.empty()) {
        mn = 0;
        break;
      }
      while (priceList.size() && a[priceList.back().second] == 0)
        priceList.pop_back();
      int indx = priceList.size() - 1;
      while (indx >= 0 && cnt > 0) {
        if (a[priceList[indx].second] < cnt) {
          ans += priceList[indx].first * a[priceList[indx].second];
          cnt -= a[priceList[indx].second];
          a[priceList[indx].second] = 0;
        } else {
          ans += priceList[indx].first * cnt;
          a[priceList[indx].second] -= cnt;
          cnt = 0;
        }
        indx--;
      }
    }
    cout << mn * ans << '\n';
  }
}
