#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, r;
  scanf("%d %d", &n, &r);
  double f[(1 << (n))], sum = 0;
  for (int i = 0; i < (1 << n); ++i) scanf("%lf", &f[i]), sum += f[i];
  printf("%0.12f\n", sum / (double)(1 << n));
  for (int i = 0; i < r; ++i) {
    int z;
    double g;
    scanf("%d %lf", &z, &g);
    sum -= f[z];
    f[z] = g;
    sum += (double)g;
    printf("%0.12f\n", sum / (double)(1 << n));
  }
  return 0;
}
