#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 177;
struct Node {
  long long id;
  long long vul;
  bool operator<(const Node& f) const { return vul < f.vul; }
} c[maxn];
long long a[maxn], b[maxn];
int main() {
  int n, m;
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    scanf("%lld", &a[i]);
  }
  for (int i = 1; i <= n; i++) {
    scanf("%lld", &c[i].vul);
    b[i] = c[i].vul;
    c[i].id = i;
  }
  sort(c + 1, c + 1 + n);
  long long index = 1;
  long long x, y;
  long long ans;
  for (int i = 1; i <= m; i++) {
    ans = 0;
    cin >> x >> y;
    if (y <= a[x]) {
      ans = ans + b[x] * y;
      a[x] = a[x] - y;
      y = 0;
    } else {
      ans = ans + b[x] * a[x];
      y = y - a[x];
      a[x] = 0;
      while (y && index <= n) {
        if (a[c[index].id] >= y) {
          a[c[index].id] = a[c[index].id] - y;
          ans = ans + y * c[index].vul;
          y = 0;
          index--;
        } else {
          ans = ans + a[c[index].id] * c[index].vul;
          y = y - a[c[index].id];
          a[c[index].id] = 0;
        }
        index++;
      }
    }
    if (y > 0) {
      cout << "0" << endl;
    } else {
      cout << ans << endl;
    }
  }
}
