#include <bits/stdc++.h>
#pragma comment(linker, "/stack:20000000")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
using namespace std;
template <typename T>
constexpr long long infValue =
    std::is_same<T, int>::value ? 2000100007 : 8600000000000000007ll;
template <typename T>
constexpr long long maxValue =
    std::is_same<T, int>::value ? 1000000007 : 1000000000000000001ll;
const long long INF = infValue<long long>;
const long long MOD = 1000000007ll;
const double EPS = 1e-6;
const long long MAX = maxValue<long long>;
using pr = pair<long long, long long>;
long long n, m;
long long a[100010], c[100010];
long long t, d, p, r;
priority_queue<pr, vector<pr>, greater<pr>> q;
int main(void) {
  scanf("%d %d", &n, &m);
  for (long long i = 0; i < n; ++i) scanf("%d", a + i);
  for (long long i = 0; i < n; ++i) scanf("%d", c + i), q.push({c[i], i});
  while (m--) {
    scanf("%d %d", &t, &d), r = 0, --t;
    p = min(d, a[t]);
    r = c[t] * p, a[t] -= p, d -= p;
    while (d) {
      while (!q.empty() && !a[q.top().second]) q.pop();
      if (q.empty())
        break;
      else {
        auto v = q.top();
        q.pop();
        t = v.second;
        p = min(d, a[t]);
        r += c[t] * p, a[t] -= p, d -= p;
        if (a[t]) q.push({c[t], t});
      }
    }
    if (d) r = 0;
    printf("%lld\n", r);
  }
  return 0;
}
