#include <bits/stdc++.h>
using namespace std;
struct pot {
  int id;
  long long y;
} p[100005];
long long a[100005], c[100005];
bool cmp(struct pot ab, struct pot ba) {
  if (ab.y != ba.y) return ab.y < ba.y;
  return ab.id < ba.id;
}
int main() {
  int n, m;
  cin >> n >> m;
  long long xx = 0;
  for (int i = 1; i <= n; i++) {
    scanf("%lld", &a[i]);
    xx += a[i];
  }
  for (int i = 1; i <= n; i++) {
    scanf("%lld", &c[i]);
    p[i].id = i;
    p[i].y = c[i];
  }
  sort(p + 1, p + 1 + n, cmp);
  long long ans = 0;
  long long ss = 0;
  int tot = 1;
  int f = 1;
  while (m--) {
    long long d, e;
    scanf("%lld%lld", &d, &e);
    ans = 0;
    if (!f) {
      printf("0\n");
      continue;
    }
    if (a[d] >= e) {
      ans += e * c[d];
      a[d] -= e;
      ss += e;
      printf("%lld\n", ans);
    } else {
      if (xx - ss < e) {
        f = 0;
        printf("0\n");
      } else {
        ans += a[d] * c[d];
        ss += e;
        long long sx = e - a[d];
        a[d] = 0;
        for (int i = tot; i <= n; i++) {
          if (sx >= a[p[i].id]) {
            ans += a[p[i].id] * c[p[i].id];
            sx -= a[p[i].id];
            a[p[i].id] = 0;
          } else {
            ans += sx * c[p[i].id];
            a[p[i].id] -= sx;
            tot = i;
            break;
          }
        }
        printf("%lld\n", ans);
      }
    }
  }
  return 0;
}
