#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1 << 18;
int n, r;
double sum = 0;
long long c[MAXN + 10];
int main() {
  scanf("%d%d", &n, &r);
  for (int i = 0; i < (1 << n); i++) {
    scanf("%lld", &c[i]);
    sum += c[i];
  }
  double dv = 1 << n;
  printf("%.9lf\n", sum / dv);
  for (int i = 0; i < r; i++) {
    int z;
    long long x;
    scanf("%d%lld", &z, &x);
    sum += x - c[z];
    c[z] = x;
    printf("%.9lf\n", sum / dv);
  }
}
