#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll llinf = (1ll << 61) - 1;
const int inf = 1000000007;
int TC = 1, CN, n, r, c[1 << 18 | 5];
signed main() {
  cin.tie(0)->sync_with_stdio(0);
  cin.exceptions(cin.failbit);
  cout.precision(11), cout.setf(ios::fixed);
  auto kase = [&]() -> void {
    cin >> n >> r;
    double sum = 0;
    for (int i = 0; i < 1 << n; i++) {
      cin >> c[i], sum += c[i];
    }
    for (int i = 0; i < r; i++) {
      cout << sum / (1 << n) << '\n';
      int z, g;
      cin >> z >> g;
      sum -= c[z], c[z] = g, sum += c[z];
    }
    cout << sum / (1 << n) << '\n';
  };
  while (CN++ != TC) kase();
}
