#include <bits/stdc++.h>
using namespace std;
typedef struct Node {
  int id;
  int weight;
  friend bool operator<(Node a, Node b) {
    if (a.weight > b.weight) return 1;
    if (a.weight == b.weight) return a.id > b.id;
    return 0;
  }
} Node;
Node node[100010];
int main() {
  int n, m;
  long long a[100010];
  long long c[100010];
  int id[100010];
  long long S = 0;
  priority_queue<Node> Q;
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) {
    scanf("%I64d", &a[i]);
    S += a[i];
  }
  for (int i = 1; i <= n; i++) {
    scanf("%I64d", &c[i]);
    Node T;
    T.id = i;
    T.weight = c[i];
    Q.push(T);
  }
  int mark = 0;
  for (int i = 0; i < m; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    if (S == 0) {
      printf("0\n");
      continue;
    }
    if (a[x] >= y) {
      printf("%I64d\n", (long long)c[x] * y);
      a[x] -= y;
      S -= y;
    } else {
      long long need = y - a[x];
      long long sum = a[x] * c[x];
      S -= a[x];
      a[x] = 0;
      int mark = 1;
      while (!Q.empty()) {
        Node T = Q.top();
        int lab = T.id;
        if (need <= a[lab]) {
          sum += (long long)(need)*c[lab];
          S -= a[lab];
          a[lab] = a[lab] - need;
          if (a[lab] == 0) Q.pop();
          mark = 0;
          printf("%I64d\n", sum);
          break;
        } else {
          sum += (long long)a[lab] * c[lab];
          need -= a[lab];
          S -= a[lab];
          a[lab] = 0;
          Q.pop();
        }
      }
      if (mark == 1) printf("0\n");
    }
  }
}
