#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 10;
int a[maxn];
int c[maxn];
long long ans[maxn];
struct xx {
  int w, index;
  xx(int w = 0, int index = 0) : w(w), index(index) {}
  friend bool operator<(const xx &A, const xx &B) {
    if (A.w != B.w) return A.w > B.w;
    return A.index > B.index;
  }
};
int main() {
  int n, m;
  while (~scanf("%d%d", &n, &m)) {
    memset((ans), 0, sizeof(ans));
    priority_queue<xx> Q;
    for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
    for (int i = 1; i <= n; i++) {
      scanf("%d", &c[i]);
      Q.push(xx(c[i], i));
    }
    for (int i = 1; i <= m; i++) {
      int t, d;
      scanf("%d%d", &t, &d);
      if (a[t] >= d) {
        ans[i] += (long long)c[t] * (long long)d;
        a[t] -= d;
      } else {
        ans[i] += (long long)c[t] * (long long)a[t];
        d -= a[t];
        a[t] = 0;
        while (!Q.empty()) {
          int fi = Q.top().index;
          if (a[fi] == 0) {
            Q.pop();
            continue;
          }
          if (a[fi] >= d) {
            ans[i] += (long long)c[fi] * (long long)d;
            a[fi] -= d;
            d = 0;
            break;
          } else {
            ans[i] += (long long)c[fi] * (long long)a[fi];
            d -= a[fi];
            a[fi] = 0;
            Q.pop();
          }
        }
        if (d != 0) ans[i] = 0LL;
      }
    }
    for (int i = 1; i <= m; i++) printf("%I64d\n", ans[i]);
  }
  return 0;
}
