#include <bits/stdc++.h>
int c[1 << 18];
int main() {
  int n, r, i, z, g;
  long long sum;
  scanf("%d%d", &n, &r);
  n = (1 << n);
  sum = 0;
  for (i = 0; i < n; ++i) {
    scanf("%d", &c[i]);
    sum += c[i];
  }
  printf("%.12f\n", sum * 1.0 / n);
  while (r--) {
    scanf("%d%d", &z, &g);
    sum -= c[z];
    sum += (c[z] = g);
    printf("%.12f\n", sum * 1.0 / n);
  }
  return 0;
}
