#include <bits/stdc++.h>
using namespace std;
const long long dx[] = {-1, -1, -1, 0, 1, 1, 1, 0};
const long long dy[] = {-1, 0, 1, 1, 1, 0, -1, -1};
long long n, x, i;
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  long long test = 1;
  while (test--) {
    long long m, unfinished;
    cin >> n >> m;
    std::set<pair<long long, long long>> val_ind;
    std::map<long long, long long> ind_num_left;
    long long quan[n], price[n];
    unfinished = n;
    for (i = 0; i < n; i++) {
      cin >> quan[i];
      ind_num_left[i] = quan[i];
    }
    for (i = 0; i < n; i++) {
      cin >> price[i];
      val_ind.insert({price[i], i});
    }
    while (m--) {
      long long ind, num, money = 0;
      cin >> ind >> num;
      ind--;
      if (num <= ind_num_left[ind]) {
        money += price[ind] * num;
        ind_num_left[ind] -= num;
      } else {
        money += price[ind] * ind_num_left[ind];
        num -= ind_num_left[ind];
        ind_num_left[ind] = 0;
        while (num > 0) {
          auto x = *(val_ind.begin());
          if (ind_num_left[x.second] <= 0) {
            val_ind.erase(*(val_ind.begin()));
            unfinished--;
            if (unfinished <= 0) {
              money = 0;
              break;
            }
            continue;
          }
          if (ind_num_left[x.second] >= num) {
            money += x.first * num;
            ind_num_left[x.second] -= num;
            num = 0;
          } else {
            money += x.first * ind_num_left[x.second];
            num -= ind_num_left[x.second];
            ind_num_left[x.second] = 0;
            val_ind.erase(*(val_ind.begin()));
            unfinished--;
            if (unfinished <= 0) {
              money = 0;
              break;
            }
          }
        }
      }
      cout << money << '\n';
    }
  }
  return 0;
}
