#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long n, m;
  cin >> n >> m;
  long long arr[n], cost[n];
  for (long long i = 0; i < n; i++) cin >> arr[i];
  set<pair<long long, long long>> s;
  for (long long i = 0; i < n; i++) {
    cin >> cost[i];
    s.insert({cost[i], i});
  }
  long long x, y;
  while (m--) {
    cin >> x >> y;
    x--;
    long long got;
    got = min(y, arr[x]);
    arr[x] -= got;
    if (got != 0 && arr[x] == 0) {
      s.erase(make_pair(cost[x], x));
    }
    long long c = got * cost[x];
    y -= got;
    while (y > 0 && !s.empty()) {
      pair<long long, long long> ele = *s.begin();
      s.erase(ele);
      long long x1, y1;
      x1 = ele.first;
      y1 = ele.second;
      got = min(y, arr[y1]);
      arr[y1] -= got;
      y -= got;
      if (arr[y1] != 0) {
        s.insert(make_pair(cost[y1], y1));
      }
      c += x1 * got;
    }
    if (y == 0)
      cout << c << endl;
    else
      cout << 0 << endl;
  }
}
