#include <bits/stdc++.h>
using namespace std;
double mc[32];
int main() {
  mc[0] = 1;
  for (int i = 1; i <= 30; i++) mc[i] = mc[i - 1] * 2;
  int n, r;
  double q;
  double sum, ans, x1, x2;
  while (scanf("%d%d", &n, &r) != EOF) {
    sum = 0;
    for (long long i = 0; i < mc[n]; i++) {
      scanf("%lf", &q);
      sum += q;
    }
    printf("%.6f\n", sum / mc[n]);
    for (int i = 0; i < r; i++) {
      scanf("%lf%lf", &x1, &x2);
      sum -= x1;
      sum += x2;
      ans = sum / mc[n];
      printf("%.6f\n", ans);
    }
  }
  return 0;
}
