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