#include <bits/stdc++.h>
using namespace std;
double gcd(double a, double b) { return a < 0.01 ? b : gcd(fmod(b, a), a); }
long long bpow(long long a, long long b, long long m) {
  a %= m;
  long long res = 1;
  while (b > 0) {
    if (b & 1) res = res * a % m;
    a = a * a % m;
    b >>= 1;
  }
  return res;
}
long long int kv;
long long int t, n, x, y, h, k, z, p, q;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> k;
  long long int a[n], c[n];
  for (long long i = 0; i < int(n); i++) cin >> a[i];
  for (long long i = 0; i < int(n); i++) cin >> c[i];
  map<pair<long long int, long long int>, long long int> m;
  for (long long i = 0; i < int(n); i++) {
    m[{c[i], i}] = a[i];
  }
  for (long long i = 0; i < int(k); i++) {
    cin >> x >> y;
    x--;
    kv = 0;
    long long int ch = 0;
    while (y > 0) {
      if (m.empty()) {
        ch = 1;
        break;
      }
      if (m.count({c[x], x})) {
        if (m[{c[x], x}] >= y) {
          m[{c[x], x}] -= y;
          if (m[{c[x], x}] == 0) m.erase({c[x], x});
          kv += c[x] * y;
          y = 0;
        } else {
          kv += m[{c[x], x}] * c[x];
          y -= m[{c[x], x}];
          m.erase({c[x], x});
        }
      } else {
        auto it = m.begin();
        if (it->second >= y) {
          it->second -= y;
          kv += c[it->first.second] * y;
          y = 0;
          if (it->second == 0) m.erase(it);
        } else {
          kv += c[it->first.second] * it->second;
          y -= it->second;
          m.erase(it);
        }
      }
    }
    cout << (ch ? 0 : kv) << '\n';
  }
  return 0;
}
