#include <bits/stdc++.h>
using namespace std;
int n, m;
struct news {
  long long num, name, pri;
} a[100005];
long long ans, sigma_num;
int mu;
int ys[100005];
int comp(news x, news y) { return x.pri < y.pri; }
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) {
    scanf("%I64d", &a[i].num);
    sigma_num += a[i].num;
    a[i].name = i;
  }
  for (int i = 1; i <= n; i++) {
    scanf("%I64d", &a[i].pri);
  }
  sort(a + 1, a + n + 1, comp);
  mu = 1;
  for (int i = 1; i <= n; i++) {
    ys[a[i].name] = i;
  }
  for (int i = 1; i <= m; i++) {
    int x;
    long long y;
    ans = 0;
    scanf("%d%I64d", &x, &y);
    if (y > sigma_num) {
      sigma_num = 0;
      printf("0\n");
      continue;
    }
    sigma_num -= y;
    x = ys[x];
    if (a[x].num >= y) {
      ans += a[x].pri * y;
      a[x].num -= y;
      printf("%I64d\n", ans);
      continue;
    }
    ans += a[x].pri * a[x].num;
    y -= a[x].num;
    a[x].num = 0;
    while (y && mu <= n) {
      if (y <= a[mu].num) {
        ans += y * a[mu].pri;
        a[mu].num -= y;
        y = 0;
        break;
      } else {
        ans += a[mu].pri * a[mu].num;
        y -= a[mu].num;
        a[mu].num = 0;
      }
      mu++;
    }
    printf("%I64d\n", ans);
  }
}
