#include <bits/stdc++.h>
using namespace std;
const int N = 1 << 20;
int n, m;
int a[N];
int c[N];
int t[N];
int d[N];
map<pair<int, int>, int> r;
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 0; i < n; ++i) scanf("%d", &a[i]);
  for (int i = 0; i < n; ++i) {
    scanf("%d", &c[i]);
    r[pair<int, int>(c[i], i)] = a[i];
  }
  for (int j = 0; j < m; ++j) {
    int t, d;
    scanf("%d%d", &t, &d);
    t--;
    long long ans = 0;
    auto it = r.find(pair<int, int>(c[t], t));
    if (it != r.end()) {
      long long num = min(it->second, d);
      ans += num * c[t];
      d -= num;
      it->second -= num;
      if (it->second == 0) r.erase(it);
    }
    while (d > 0 && !r.empty()) {
      auto it = r.begin();
      long long num = min(it->second, d);
      ans += num * it->first.first;
      d -= num;
      it->second -= num;
      if (it->second == 0) r.erase(it);
    }
    if (d > 0) ans = 0;
    printf("%lld\n", ans);
  }
  return 0;
}
