#include <bits/stdc++.h>
using namespace std;
const long long int mod = 1000000007;
const long double PI = 3.141592653589793;
const long long int inf = 1e18;
long long int gcd(long long int a, long long int b) {
  if (b == 0)
    return a;
  else
    return gcd(b, a % b);
}
long long int lcm(long long int a, long long int b) {
  return ((a * b) / gcd(a, b));
}
long long int power(long long int x, long long int y, long long int p) {
  long long int res = 1;
  x = x % p;
  while (y > 0) {
    if (y & 1) res = (res * x) % p;
    y = y >> 1;
    x = ((x % p) * (x % p)) % p;
  }
  return res % p;
}
long long int modInverse(long long int n, long long int p) {
  return power(n, p - 2, p) % p;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long int n, m;
  cin >> n >> m;
  vector<long long int> a;
  long long int total = 0;
  for (long long int i = 0; i < n; i++) {
    long long int x;
    cin >> x;
    total += x;
    a.push_back(x);
  }
  vector<long long int> c;
  multiset<pair<pair<long long int, long long int>, long long int>> s;
  for (long long int i = 0; i < n; i++) {
    long long int x;
    cin >> x;
    c.push_back(x);
    s.insert(make_pair(make_pair(x, i), a[i]));
  }
  long long int check = 0;
  while (m--) {
    long long int x, y;
    cin >> x >> y;
    x--;
    if (check + y > total) {
      cout << "0" << endl;
      check = inf;
      continue;
    }
    check += y;
    long long int sum = 0;
    if (a[x] >= y) {
      cout << c[x] * y << endl;
      pair<pair<long long int, long long int>, long long int> tp =
          make_pair(make_pair(c[x], x), a[x]);
      s.erase(tp);
      s.insert(make_pair(make_pair(c[x], x), a[x] - y));
      a[x] -= y;
      continue;
    }
    sum += a[x] * c[x];
    y -= a[x];
    pair<pair<long long int, long long int>, long long int> tp =
        make_pair(make_pair(c[x], x), a[x]);
    s.erase(tp);
    a[x] = 0;
    while (y > 0 && !s.empty()) {
      auto it = s.begin();
      long long int val = (*it).second;
      if (y <= val) {
        sum += (*it).first.first * y;
        long long int q = (*it).first.first;
        long long int w = (*it).first.second;
        s.erase(it);
        s.insert(make_pair(make_pair(q, w), val - y));
        a[w] -= y;
        y = 0;
        break;
      }
      sum += (*it).first.first * val;
      y -= val;
      a[(*it).first.second] = 0;
      s.erase(it);
    }
    cout << sum << endl;
  }
  return 0;
}
