#include <bits/stdc++.h>
using namespace std;
bool isPrime(long long n) {
  if (n <= 1) return false;
  if (n <= 3) return true;
  if (n % 2 == 0 || n % 3 == 0) return false;
  for (long long i = 5; i * i <= n; i = i + 6)
    if (n % i == 0 || n % (i + 2) == 0) return false;
  return true;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long x, y = 0, t, q, n = 0, m, i, j, k = 1, ans = 0, z;
  string s, p;
  cin >> n >> m;
  vector<pair<long long, long long> > cost_sort;
  vector<long long> rem, cost;
  for (i = 0; i < n; i++) {
    cin >> x;
    rem.push_back(x);
  }
  for (i = 0; i < n; i++) {
    cin >> x;
    cost_sort.push_back({x, i});
    cost.push_back(x);
  }
  sort(cost_sort.begin(), cost_sort.end());
  long long var, no;
  k = 0;
  for (j = 0; j < m; j++) {
    cin >> var >> no;
    var--;
    long long ans = 0;
    if (rem[var] >= no) {
      ans = cost[var] * no;
      rem[var] -= no;
    } else {
      long long temp = 0;
      no -= rem[var];
      temp += rem[var] * cost[var];
      rem[var] = 0;
      for (i = k; i < cost_sort.size(); i++) {
        if (no > 0) {
          t = cost_sort[i].second;
          if (rem[t] > 0) {
            long long quant = min(no, rem[t]);
            no -= quant;
            temp += cost[t] * quant;
            rem[t] -= quant;
            if (no == 0) {
              k = i;
              break;
            }
          }
        } else {
          break;
        }
      }
      if (no == 0) ans = temp;
    }
    cout << ans << "\n";
  }
}
