#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int TESTS = 1;
  while (TESTS--) {
    long long m, n;
    cin >> n >> m;
    vector<long long int> a(n), c(n);
    long long sum = 0;
    for (long long int i = 0; i < n; i++) {
      cin >> a[i];
      sum += a[i];
    }
    std::vector<pair<long long int, long long int> > v;
    for (long long int i = 0; i < n; i++) {
      cin >> c[i];
      v.push_back({c[i], i});
    }
    sort((v).begin(), (v).end());
    reverse((v).begin(), (v).end());
    stack<long long> st;
    for (long long int i = 0; i < n; i++) {
      st.push(v[i].second);
    }
    vector<long long int> cust;
    for (long long int i = 0; i < m; i++) {
      long long ti, di;
      cin >> ti >> di;
      if (di > sum) {
        cust.push_back(0);
        sum = 0;
      } else {
        if (a[ti - 1] >= di) {
          cust.push_back(di * c[ti - 1]);
          a[ti - 1] -= di;
          sum -= di;
        } else {
          long long cst = 0;
          cst += a[ti - 1] * c[ti - 1];
          di -= a[ti - 1];
          sum -= a[ti - 1];
          a[ti - 1] = 0;
          while (!st.empty()) {
            long long idx = st.top();
            if (a[idx] >= di) {
              a[idx] -= di;
              cst += di * c[idx];
              sum -= di;
              di = 0;
              break;
            } else {
              di -= a[idx];
              cst += a[idx] * c[idx];
              sum -= a[idx];
              a[idx] = 0;
              st.pop();
            }
          }
          cust.push_back(cst);
        }
      }
    }
    for (long long int i = 0; i < m; i++) cout << cust[i] << "\n";
  }
  return 0;
}
