#include <bits/stdc++.h>
using namespace std;
int N, M, K;
long long a[100005], c[100005];
pair<long long, long long> inp[100005];
int main() {
  scanf("%d %d", &N, &M);
  for (int i = 1; i <= N; i++) {
    scanf("%lld", a + i);
  }
  for (int i = 1; i <= N; i++) {
    scanf("%lld", c + i);
    inp[i] = {c[i], i};
  }
  sort(inp + 1, inp + N + 1);
  int j = 1;
  while (M--) {
    int t;
    long long d;
    scanf("%d %lld", &t, &d);
    long long A = min(a[t], d);
    a[t] -= A;
    d -= A;
    long long remain = 0;
    while (j <= N && d) {
      long long B = min(a[inp[j].second], d);
      d -= B;
      a[inp[j].second] -= B;
      remain += B * inp[j].first;
      if (!d) break;
      j++;
    }
    printf("%lld\n", d ? 0 : A * c[t] + remain);
  }
}
