#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  scanf("%d %d", &n, &m);
  int a[n + 1], c[n + 1], t, d;
  vector<pair<int, int> > v;
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
  }
  for (int i = 1; i <= n; i++) {
    scanf("%d", &c[i]);
    v.push_back(make_pair(c[i], i));
  }
  sort(v.begin(), v.end());
  int k = 0;
  for (int i = 1; i <= m; i++) {
    scanf("%d %d", &t, &d);
    int remain = a[t];
    if (a[t] > 0) a[t] -= min(a[t], d);
    int need = d - (remain - a[t]);
    long long cost = 1LL * c[t] * (d - need);
    if (k < n) {
      int j = k;
      while (need != 0) {
        int x = v[j].first;
        int y = v[j].second;
        int r = a[y];
        if (r > 0) a[y] -= min(a[y], need);
        need -= r - a[y];
        cost += 1LL * x * (r - a[y]);
        if (a[y] == 0) ++k;
        ++j;
        if (j == n) break;
      }
    }
    if (!need)
      printf("%I64d\n", cost);
    else
      printf("0\n");
  }
  return 0;
}
