#include <bits/stdc++.h>
using namespace std;
const int maxn = 100007;
const int ooi = 1e9 + 7;
const long long mod = 1e9 + 7;
const long long ool = 1e18 + 7;
long long cost[maxn];
long long used[maxn];
long long has[maxn];
long long yu1;
int main(void) {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, q;
  cin >> n >> q;
  set<pair<long long, long long> > nowmi;
  for (int i = (1); i <= (n); ++i) cin >> has[i], yu1 += has[i];
  for (int i = (1); i <= (n); ++i) {
    cin >> cost[i];
    nowmi.insert({cost[i], i});
  }
  while (q--) {
    long long nd;
    long long kd;
    cin >> kd >> nd;
    if (yu1 <= 0) {
      cout << 0 << endl;
      continue;
    }
    long long c = 0;
    yu1 -= nd;
    if (nd <= has[kd] - used[kd]) {
      used[kd] += nd;
      if (used[kd] == has[kd]) nowmi.erase({cost[kd], kd});
      c = cost[kd] * nd;
      cout << c << endl;
      continue;
    }
    nd -= (has[kd] - used[kd]);
    c += (has[kd] - used[kd]) * cost[kd];
    used[kd] = has[kd];
    int ok = 0;
    for (; nowmi.size() != 0;) {
      auto tp = *nowmi.begin();
      int pos = tp.second;
      long long dt = has[pos] - used[pos];
      if (dt >= nd) {
        c += nd * cost[pos];
        used[pos] += nd;
        if (used[pos] == has[pos]) nowmi.erase(tp);
        ok = 1;
        break;
      }
      used[pos] = has[pos];
      nowmi.erase(tp);
      c += dt * cost[pos];
      nd -= dt;
    }
    if (ok)
      cout << c << endl;
    else
      cout << 0 << endl;
  }
  return 0;
}
