#include <bits/stdc++.h>
using namespace std;
int n, m, a[100005], cst[100005];
set<pair<int, int> > st;
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  for (int i = 1; i <= n; i++)
    scanf("%d", &cst[i]), st.insert(make_pair(cst[i], i));
  for (; m--;) {
    int t, d;
    scanf("%d%d", &t, &d);
    long long ret = 0;
    if (a[t]) {
      ret += 1ll * min(a[t], d) * cst[t];
      int tmp = min(a[t], d);
      a[t] -= tmp, d -= tmp;
      if (!a[t]) st.erase(make_pair(cst[t], t));
    }
    for (; d && !st.empty();) {
      int id = (*st.begin()).second;
      int tmp = min(a[id], d);
      ret += 1ll * tmp * cst[id];
      a[id] -= tmp, d -= tmp;
      if (!a[id]) st.erase(make_pair(cst[id], id));
    }
    if (d) {
      ret = 0;
    }
    printf("%I64d\n", ret);
  }
}
