#include <bits/stdc++.h>
using namespace std;
const int MAXN = 5 + 100000;
int n, m, rem[MAXN];
long long c[MAXN];
bool ok[MAXN];
set<pair<int, int>> s;
long long solve(int k, int num) {
  if (num >= rem[k]) {
    long long cost = 0LL;
    if (ok[k]) {
      cost = 1LL * rem[k] * c[k];
      num -= rem[k];
      rem[k] = 0;
      ok[k] = false;
      assert(s.find({c[k], k}) != s.end());
      s.erase(s.find({c[k], k}));
    }
    if (num > 0) return cost + solve(s.begin()->second, num);
    return cost;
  } else {
    long long cost = 1LL * num * c[k];
    rem[k] -= num;
    return cost;
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  cin >> n >> m;
  long long totrem = 0LL;
  for (int i = (int)0; i < (int)n; ++i) cin >> rem[i], totrem += rem[i];
  for (int i = (int)0; i < (int)n; ++i) cin >> c[i];
  for (int i = (int)0; i < (int)n; ++i) {
    s.insert({c[i], i});
    ok[i] = true;
  }
  bool can = true;
  while (m--) {
    int kf, num;
    cin >> kf >> num;
    if (num > totrem || !can) {
      cout << 0 << '\n';
      can = false;
    } else {
      cout << solve(kf - 1, num) << '\n';
      totrem -= num;
    }
  }
  return 0;
}
