#include <bits/stdc++.h>
using namespace std;
const long long MAXN = 1e5 + 7;
long long n, m, a[MAXN], c[MAXN], t, d;
map<pair<long long, long long>, long long> lst;
long long dec(long long id, long long x) {
  long long delta = min(x, lst[make_pair(c[id], id)]);
  lst[make_pair(c[id], id)] -= delta;
  if (lst[make_pair(c[id], id)] == 0) {
    lst.erase(make_pair(c[id], id));
  }
  return delta * c[id];
}
signed main() {
  scanf("%lld%lld", &n, &m);
  for (long long i = 1; i <= n; i++) {
    scanf("%lld", &a[i]);
  }
  for (long long i = 1; i <= n; i++) {
    scanf("%lld", &c[i]);
  }
  for (long long i = 1; i <= n; i++) {
    lst[make_pair(c[i], i)] = a[i];
  }
  while (m--) {
    scanf("%lld%lld", &t, &d);
    long long tmp = dec(t, d);
    long long ans = 0;
    ans += tmp;
    d -= tmp / c[t];
    while (d && !lst.empty()) {
      long long id = lst.begin()->first.second;
      tmp = dec(id, d);
      ans += tmp;
      d -= tmp / c[id];
    }
    if (d)
      puts("0");
    else
      printf("%lld\n", ans);
  }
  return 0;
}
