#include <bits/stdc++.h>
using namespace std;
vector<pair<long long, long long> > v;
long long a[100005], c[100005];
void print(long long n) {
  for (long long i = 0; i < n; i++) {
    cout << "{" << v[i].first << "," << v[i].second << "} ";
  }
  cout << "\n";
}
void pt(long long a[], long long n) {
  for (int i = 0; i < n; i++) cout << a[i] << " ";
  cout << "\n";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int TESTS = 1;
  while (TESTS--) {
    long long n, m, i, j, k, tot_dishes = 0;
    cin >> n >> m;
    for (i = 0; i < n; i++) {
      cin >> a[i];
      tot_dishes += a[i];
    }
    for (i = 0; i < n; i++) cin >> c[i];
    for (i = 0; i < n; i++) v.push_back(make_pair(c[i], i));
    sort((v).begin(), (v).end());
    long long ptr = 0;
    for (i = 0; i < m; i++) {
      long long qty, type;
      cin >> type >> qty;
      type--;
      if (qty <= tot_dishes) {
        long long cost = 0;
        if (qty <= a[type]) {
          cost += (qty * c[type]);
          a[type] -= qty;
          tot_dishes -= qty;
          qty = 0;
        } else {
          cost += (a[type] * c[type]);
          tot_dishes -= a[type];
          qty -= a[type];
          a[type] = 0;
          while (qty > 0 && ptr < n) {
            long long idx = v[ptr].second;
            if (qty <= a[idx]) {
              cost += (qty * c[idx]);
              a[idx] -= qty;
              tot_dishes -= qty;
              qty = 0;
            } else {
              cost += (a[idx] * c[idx]);
              qty -= a[idx];
              tot_dishes -= a[idx];
              a[idx] = 0;
              ptr++;
            }
          }
        }
        cout << cost << "\n";
      } else {
        ptr = n;
        tot_dishes = 0;
        cout << "0\n";
      }
    }
  }
  return 0;
}
