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