#include <bits/stdc++.h>
using namespace std;
const int M = 1 << 18 | 1;
int n, m, f[M], N;
double tot;
int a, b;
int main() {
  scanf("%d%d", &n, &m);
  N = 1 << n;
  for (int i = 0; i < N; i++) {
    scanf("%d", &f[i]);
    tot += f[i];
  }
  printf("%lf\n", tot / N);
  for (int i = 1; i <= m; i++) {
    scanf("%d%d", &a, &b);
    tot += b - f[a];
    printf("%lf\n", tot / N);
    f[a] = b;
  }
  return 0;
}
