#include <bits/stdc++.h>
long long sum = 0, dd = 0;
int N, R, V[(1 << 18) + 233];
int main() {
  scanf("%d%d", &N, &R);
  dd = 1 << N;
  for (int i = 0; i < dd; ++i) {
    scanf("%d", V + i);
    sum += V[i];
  }
  printf("%.10lf\n", sum / (double)dd);
  for (int i = 0; i < R; ++i) {
    int z, g;
    scanf("%d%d", &z, &g);
    sum -= V[z];
    V[z] = g;
    sum += g;
    printf("%.10lf\n", sum / (double)dd);
  }
}
