#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  long long n, q, x, y;
  cin >> n >> q;
  n = 1 << n;
  vector<long long> v(n);
  long long sum = 0;
  for (auto &i : v) {
    cin >> i;
    sum += i;
  }
  for (long long i = 0; i < q; i++) {
    cout << fixed << setprecision(10) << (1.l * sum / n) << '\n';
    cin >> x >> y;
    sum += y - v[x];
    v[x] = y;
  }
  cout << fixed << setprecision(10) << (1.l * sum / n) << '\n';
}
