#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  long long a[n];
  vector<pair<long long, long long>> c(n);
  long long sum = 0;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    sum += a[i];
  }
  priority_queue<pair<long long, int>> Q;
  for (int i = 0; i < n; i++) {
    cin >> c[i].first;
    c[i].second = i;
    Q.push(make_pair(-1 * c[i].first, -1 * c[i].second));
  }
  vector<pair<int, int>> cust(m);
  for (int i = 0; i < m; i++) cin >> cust[i].first >> cust[i].second;
  unordered_map<long long, long long> mpp;
  for (auto i : c) {
    mpp[i.second] = i.first;
  }
  for (auto i : cust) {
    if (sum == 0 || sum < i.second) {
      cout << "0\n";
      sum = 0;
      continue;
    }
    long long tot = 0;
    int kind = i.first;
    int amt = i.second;
    sum -= amt;
    int rem = a[kind - 1];
    if (rem >= amt) {
      tot += (amt * mpp[kind - 1]);
      a[kind - 1] -= amt;
    } else {
      tot += (a[kind - 1] * mpp[kind - 1]);
      amt -= a[kind - 1];
      a[kind - 1] = 0;
      while (amt != 0) {
        auto p = Q.top();
        long long cost = -1 * p.first;
        long long ind = -1 * p.second;
        if (a[ind] >= amt) {
          tot += cost * (amt);
          a[ind] -= amt;
          amt = 0;
        } else {
          amt -= a[ind];
          tot += cost * (a[ind]);
          a[ind] = 0;
          Q.pop();
        }
      }
    }
    cout << tot << "\n";
  }
  return 0;
}
