#include <bits/stdc++.h>
using namespace std;
struct zz {
  long long fir, sec, id;
} sit[500005];
bool cmp(zz const &x, zz const &y) { return x.sec < y.sec; }
long long m, rkk[500005], n;
int main() {
  cin >> n >> m;
  for (int i = 1; i <= n; i++) cin >> sit[i].fir;
  for (int i = 1; i <= n; i++) cin >> sit[i].sec;
  for (int i = 1; i <= n; i++) sit[i].id = i;
  sort(sit + 1, sit + 1 + n, cmp);
  long long l = 1;
  for (int i = 1; i <= n; i++) rkk[sit[i].id] = i;
  while (m-- > 0) {
    long long k, p;
    cin >> k >> p;
    k = rkk[k];
    long long mn = min(p, sit[k].fir), q = 0;
    p -= mn, q += mn * sit[k].sec, sit[k].fir -= mn;
    while (p > 0) {
      while (!sit[l].fir && l <= n) l++;
      if (l > n) {
        q = 0;
        break;
      }
      mn = min(p, sit[l].fir), p -= mn, sit[l].fir -= mn, q += mn * sit[l].sec;
    }
    cout << q << endl;
  }
  return 0;
}
