#include <bits/stdc++.h>
using namespace std;
vector<long> v[100001];
long f[1000001] = {};
long a[100001] = {};
long c[100001] = {};
long t[100001] = {};
long d[100001] = {};
int main() {
  long n, m;
  scanf("%ld %ld", &n, &m);
  for (long i = 0; i < n; i++) scanf("%ld", &a[i]);
  set<long> e;
  long distinctCost = 1;
  for (long i = 0; i < n; i++) {
    scanf("%ld", &c[i]);
    if (f[c[i]] == 0) {
      e.insert(c[i]);
      f[c[i]] = distinctCost;
      distinctCost++;
    }
    v[f[c[i]]].push_back(i);
  }
  long long cost;
  long i;
  set<long>::iterator it = e.begin();
  for (long j = 0; j < m; j++) {
    scanf("%ld %ld", &t[j], &d[j]);
    t[j]--;
    cost = 0;
    if (a[t[j]] >= d[j]) {
      cost += ((long long)c[t[j]] * (long long)d[j]);
      a[t[j]] -= d[j];
    } else {
      cost += ((long long)a[t[j]] * (long long)c[t[j]]);
      d[j] -= a[t[j]];
      a[t[j]] = 0;
      while (d[j]) {
        while (it != e.end()) {
          if (v[f[*it]].size() == 0) {
            it++;
            continue;
          }
          i = 0;
          while (i != v[f[*it]].size()) {
            if (a[v[f[*it]][i]] != 0) break;
            i++;
          }
          if (i == v[f[*it]].size())
            it++;
          else
            break;
        }
        if (it == e.end()) break;
        if (a[v[f[*it]][i]] >= d[j]) {
          cost += ((long long)c[v[f[*it]][i]] * (long long)d[j]);
          a[v[f[*it]][i]] -= d[j];
          d[j] = 0;
        } else {
          cost += ((long long)c[v[f[*it]][i]] * (long long)a[v[f[*it]][i]]);
          d[j] -= a[v[f[*it]][i]];
          a[v[f[*it]][i]] = 0;
        }
      }
      if (d[j]) cost = 0;
    }
    cout << cost << endl;
  }
}
