#include <bits/stdc++.h>
using namespace std;
int a[500000];
int p[20];
int main() {
  p[0] = 1;
  for (int i = 1; i <= 18; i++) p[i] = p[i - 1] * 2;
  int n, r;
  scanf("%d %d", &n, &r);
  double ans = 0;
  for (int i = 0; i < p[n]; i++) {
    scanf("%d", &a[i]);
    ans += a[i];
  }
  printf("%.6f\n", ans / (p[n] * 1.0));
  int z, g;
  while (r--) {
    scanf("%d %d", &z, &g);
    ans -= a[z];
    ans += g;
    printf("%.6f\n", ans / (p[n] * 1.0));
  }
}
