#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 10;
int f[maxn];
struct node {
  int num, c, id;
} a[maxn];
bool cmp(const node& a, const node& b) {
  if (a.c == b.c) return a.id < b.id;
  return a.c < b.c;
}
int main() {
  int n, m, pos = 1, t, d;
  long long ans;
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) scanf("%d", &(a[i].num));
  for (int i = 1; i <= n; i++) scanf("%d", &(a[i].c)), a[i].id = i;
  sort(a + 1, a + n + 1, cmp);
  for (int i = 1; i <= n; i++) f[a[i].id] = i;
  while (m--) {
    ans = 0;
    scanf("%d%d", &t, &d);
    if (a[f[t]].num >= d) {
      ans = 1LL * d * a[f[t]].c;
      a[f[t]].num -= d;
      printf("%lld\n", ans);
    } else {
      ans = 1LL * a[f[t]].num * a[f[t]].c;
      d -= a[f[t]].num;
      a[f[t]].num = 0;
      while (d) {
        if (pos == n + 1) {
          printf("0\n");
          break;
        }
        if (a[pos].num >= d) {
          ans += 1LL * a[pos].c * d;
          a[pos].num -= d;
          printf("%lld\n", ans);
          if (a[pos].num == 0) pos++;
          break;
        } else {
          d -= a[pos].num;
          ans += 1LL * a[pos].c * a[pos].num;
          a[pos].num = 0;
          pos++;
        }
      }
    }
  }
  return 0;
}
