#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 4;
long long it = 1, n, m, a[N], c[N];
pair<int, int> lowCost[N];
void read() {
  cin >> n >> m;
  for (int i = 0; i < n; ++i) {
    cin >> a[i + 1];
  }
  for (int i = 0; i < n; ++i) {
    cin >> c[i + 1];
    lowCost[i + 1] = {c[i + 1], i + 1};
  }
  sort(lowCost + 1, lowCost + 1 + n);
}
long long ans[N];
long long calc(long long t, long long d) {
  long long res = 0;
  while (d > 0) {
    if (a[t] >= d) {
      res += c[t] * d;
      a[t] -= d;
      break;
    }
    if (a[t] > 0) {
      res += c[t] * a[t];
      d -= a[t];
      a[t] = 0;
      continue;
    }
    if (a[t] == 0) {
      while (it <= n && a[lowCost[it].second] == 0) {
        ++it;
      }
      if (it > n) {
        res = 0;
        break;
      }
      t = lowCost[it].second;
    }
  }
  return res;
}
void write() {
  for (int i = 0; i < m; ++i) {
    cout << ans[i] << "\n";
  }
}
void solve() {
  read();
  for (int i = 0; i < m; ++i) {
    long long t, d;
    cin >> t >> d;
    ans[i] = calc(t, d);
  }
  write();
}
int main() {
  ios_base::sync_with_stdio(false);
  cout.tie(0);
  cin.tie(0);
  solve();
  return 0;
}
