#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
enum { MOD0 = 1000000000, MOD7 = 1000000007, MOD9 = 1000000009 };
int c[1 << 18];
void print(long long sum, int n) { cout << (long double)sum / n << '\n'; }
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout << fixed << setprecision(20);
  int n, r;
  cin >> n >> r;
  long long sum = 0;
  const int sz = 1 << n;
  for (int i = 0; i < sz; ++i) {
    cin >> c[i];
    sum += c[i];
  }
  print(sum, sz);
  while (r--) {
    int z, g;
    cin >> z >> g;
    sum -= c[z];
    c[z] = g;
    sum += c[z];
    print(sum, sz);
  }
  return 0;
}
