#include <bits/stdc++.h>
using namespace std;
int n, m;
int a[100050], c[100050];
long long A;
struct cmp {
  bool operator()(const int i, const int j) const {
    return c[i] < c[j] || (c[i] == c[j] && i < j);
  }
};
set<int, cmp> q;
long long calc(int i, int s, int &d) {
  if (!s) return 0;
  a[i] -= s, d -= s, A -= s;
  if (!a[i] && q.count(i)) q.erase(i);
  return 1LL * c[i] * s;
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; ++i) scanf("%d", a + i), A += a[i];
  for (int i = 1; i <= n; ++i) scanf("%d", c + i), q.insert(i);
  while (m--) {
    int i, d, s;
    scanf("%d%d", &i, &d);
    long long ans = calc(i, min(d, a[i]), d);
    while (d && A) {
      int i = *q.begin();
      ans += calc(i, min(d, a[i]), d);
    }
    if (d) ans = 0;
    printf("%lld\n", ans);
  }
  return 0;
}
