#include <bits/stdc++.h>
const int oo = 2139063143;
const int N = 1010000;
const int mod = 1000000007;
using namespace std;
inline void sc(long long &x) {
  x = 0;
  static int p;
  p = 1;
  static char c;
  c = getchar();
  while (!isdigit(c)) {
    if (c == '-') p = -1;
    c = getchar();
  }
  while (isdigit(c)) {
    x = (x << 1) + (x << 3) + (c - 48);
    c = getchar();
  }
  x *= p;
}
struct LY {
  long long a, c, id;
} s[N];
bool ly(LY A, LY B) { return (A.c == B.c) ? (A.id < B.id) : (A.c < B.c); }
long long nxt[N], pre[N], pos[N];
int main() {
  long long n, m, sum = 0;
  sc(n), sc(m);
  nxt[0] = 1;
  for (int i = 1; i <= n; i++)
    sc(s[i].a), s[i].id = i, nxt[i] = i + 1, pre[i] = i - 1, sum += s[i].a;
  for (int i = 1; i <= n; i++) sc(s[i].c);
  sort(s + 1, s + n + 1, ly);
  for (int i = 1; i <= n; i++) pos[s[i].id] = i;
  while (m--) {
    long long t, d;
    sc(t), sc(d);
    if (sum < d) {
      sum = 0;
      printf("%I64d\n", 0LL);
      continue;
    }
    sum -= d;
    t = pos[t];
    if (s[t].a > d) {
      s[t].a -= d;
      printf("%I64d\n", d * s[t].c);
      continue;
    }
    long long ans = s[t].a * s[t].c;
    d -= s[t].a;
    if (s[t].a) {
      s[t].a = 0;
      nxt[pre[t]] = nxt[t], pre[nxt[t]] = pre[t];
    }
    for (int i = 0; i <= n && d; i = nxt[i]) {
      if (s[i].a > d) {
        s[i].a -= d;
        ans += d * s[i].c;
        break;
      }
      ans += s[i].a * s[i].c;
      d -= s[i].a;
      if (s[i].a) {
        s[i].a = 0;
        nxt[pre[i]] = nxt[i], pre[nxt[i]] = pre[i];
      }
    }
    printf("%I64d\n", ans);
  }
  return 0;
}
