#include <bits/stdc++.h>
using namespace std;
long long int dir[4][2] = {{1, 0}, {-1, 0}, {0, 1}, {0, -1}};
void solve() {
  int n, m;
  cin >> n >> m;
  vector<long long int> a(n), c(n);
  map<long long int, vector<long long int>> hh;
  priority_queue<pair<long long int, vector<long long int>>,
                 vector<pair<long long int, vector<long long int>>>,
                 greater<pair<long long int, vector<long long int>>>>
      pq;
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < n; i++) {
    cin >> c[i];
    hh[c[i]].push_back(i);
  }
  for (auto it : hh) {
    pq.push({it.first, it.second});
  }
  for (int i = 0; i < m; i++) {
    long long int type, q;
    long long int ans = 0, rem = 0;
    cin >> type >> q;
    type--;
    if (a[type] >= q) {
      ans = q * c[type];
      a[type] -= q;
    } else {
      ans = a[type] * c[type];
      rem = q - a[type];
      a[type] = 0;
      while (!pq.empty()) {
        long long int cost = pq.top().first;
        vector<long long int> v = pq.top().second, vv;
        pq.pop();
        for (auto it : v) {
          if (rem < a[it] && a[it]) {
            ans += (rem * c[it]);
            a[it] -= rem;
            vv.push_back(it);
            rem = 0;
          } else {
            ans += (a[it] * c[it]);
            rem -= a[it];
            a[it] = 0;
          }
        }
        if (vv.size()) {
          pq.push({cost, vv});
          break;
        }
      }
    }
    if (rem)
      cout << 0 << '\n';
    else
      cout << ans << '\n';
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cout.tie(NULL);
  cin.tie(NULL);
  ;
  long long int t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
