#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, r;
  scanf("%d%d", &n, &r);
  vector<double> c(1 << n);
  double s = 0.0;
  for (int i = 0; i < (1 << n); i++) {
    scanf("%lf", &c[i]);
    s += c[i];
  }
  double p = pow(2.0, n);
  printf("%.7lf\n", s / p);
  while (r--) {
    int x;
    double g;
    scanf("%d%lf", &x, &g);
    s += g - c[x];
    c[x] = g;
    printf("%.7lf\n", s / p);
  }
  return 0;
}
