#include <bits/stdc++.h>
using namespace std;
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << " : " << arg1 << " | ";
  __f(comma + 1, args...);
}
const int N = 1 << 20;
int f[N];
int main() {
  int n, r;
  scanf("%d", &(n));
  scanf("%d", &(r));
  long long sm = 0;
  for (int i = 0; i < (1 << n); i++) scanf("%d", &(f[i])), sm += f[i];
  for (int i = 0; i <= r; i++) {
    printf("%.10lf\n", sm * 1. / (1 << n));
    int z, g;
    if (i != r) {
      scanf("%d", &(z));
      scanf("%d", &(g));
      sm += g - f[z];
      f[z] = g;
    }
  }
}
