#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:1024000000,1024000000")
using namespace std;
const long long inf = 0x3f3f3f3f3f3f3f3f;
const int maxn = 100005;
int main() {
  int n;
  long long r;
  scanf("%d %lld", &n, &r);
  n = 1 << n;
  int c[n];
  double sum = 0;
  for (int i = 0; i < n; i++) scanf("%d", &c[i]), sum += c[i];
  printf("%.6f\n", sum / n);
  for (int i = 0; i < r; i++) {
    int z, g;
    scanf("%d %d", &z, &g);
    sum = sum - c[z] + g;
    c[z] = g;
    printf("%.6f\n", sum / n);
  }
}
