#include <bits/stdc++.h>
using namespace std;
const int ppr = 257;
const long long INF = 1e18;
const int inf = 1e9;
const int mod = 1e9 + 9;
const int N = 1e6 + 123;
const long double pi = 3.141592653589793238462643;
const int dx[] = {1, 0, -1, 0};
const int dy[] = {0, 1, 0, -1};
bool ok = 1;
long long n, m, a[N], c[N];
set<pair<pair<long long, long long>, long long> > st;
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> n >> m;
  for (long long i = 1; i <= n; i++) cin >> a[i];
  for (long long i = 1; i <= n; i++)
    cin >> c[i], st.insert(make_pair(make_pair(c[i], a[i]), i));
  ok = 1;
  while (m--) {
    long long t, d;
    cin >> t >> d;
    if (!ok) {
      cout << 0 << '\n';
      continue;
    }
    long long sum = 0;
    long long z = min(a[t], d);
    st.erase(make_pair(make_pair(c[t], a[t]), t));
    a[t] -= z;
    d -= z;
    sum += c[t] * z;
    if (a[t]) st.insert(make_pair(make_pair(c[t], a[t]), t));
    while (d && !st.empty()) {
      pair<pair<long long, long long>, long long> q = (*st.begin());
      long long id = q.second;
      long long y = min(a[id], d);
      st.erase(make_pair(make_pair(c[id], a[id]), id));
      a[id] -= y;
      d -= y;
      sum += y * c[id];
      if (a[id]) st.insert(make_pair(make_pair(c[id], a[id]), id));
    }
    if (d) ok = sum = 0;
    cout << sum << '\n';
  }
  return 0;
}
