#include <bits/stdc++.h>
using namespace std;
const int N = 100010;
priority_queue<pair<int, int>, vector<pair<int, int> >,
               greater<pair<int, int> > >
    q;
int a[N], c[N], n, m;
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", &c[i]);
    q.push(pair<int, int>(c[i], i));
  }
  for (int i = 1; i <= m; i++) {
    int x, y;
    long long cost = 0;
    scanf("%d%d", &x, &y);
    if (a[x] >= y) {
      a[x] -= y;
      cost += (long long)c[x] * y;
      printf("%lld\n", cost);
    } else {
      bool flag = 0;
      cost += (long long)c[x] * a[x];
      y -= a[x];
      a[x] = 0;
      while (!q.empty()) {
        int now = q.top().second;
        if (a[now] >= y) {
          a[now] -= y;
          cost += (long long)c[now] * y;
          flag = 1;
          break;
        } else {
          cost += (long long)c[now] * a[now];
          y -= a[now];
          a[now] = 0;
          q.pop();
        }
      }
      if (!flag)
        printf("%d\n", 0);
      else
        printf("%lld\n", cost);
    }
  }
  return 0;
}
