#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, q;
  scanf("%d%d", &n, &q);
  n = 1 << n;
  int* f = new int[n];
  long long sum = 0;
  for (int* it = f; it < f + n; ++it) {
    scanf("%d", it);
    sum += (long long)*it;
  }
  printf("%.10lf\n", (double)sum / n);
  int z;
  while (q--) {
    scanf("%d", &z);
    sum -= (long long)f[z];
    scanf("%d", &f[z]);
    sum += (long long)f[z];
    printf("%.10lf\n", (double)sum / n);
  }
}
