#include <bits/stdc++.h>
using namespace std;
const char DEBUG = 0;
mt19937 gen(
    (unsigned)chrono::high_resolution_clock::now().time_since_epoch().count());
#pragma comment(linker, "/STACK:16777216")
struct pp {
  long long cost, id;
};
bool operator<(const pp& a, const pp& b) {
  return a.cost < b.cost || (a.cost == b.cost && a.id < b.id);
}
long long a[100005];
long long c[100005];
long long n, q;
map<pp, long long> st;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> q;
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < n; i++) {
    cin >> c[i];
    st[{c[i], i}] = a[i];
  }
  while (q--) {
    long long t, d;
    cin >> t >> d;
    --t;
    long long k = min(d, st[{c[t], t}]);
    long long cost = k * c[t];
    d -= k;
    st[{c[t], t}] -= k;
    if (st[{c[t], t}] <= 0) st.erase({c[t], t});
    while (!st.empty() && d > 0) {
      k = min(d, st.begin()->second);
      d -= k;
      cost += k * c[st.begin()->first.id];
      st[st.begin()->first] -= k;
      if (st.begin()->second <= 0) st.erase(st.begin());
    }
    if (d) cost = 0;
    cout << cost << "\n";
  }
  return 0;
}
