#include <bits/stdc++.h>
using namespace std;
const int maxn = 3e5 + 1;
const int inf = 0x3f3f3f3f;
const long long mod = 1e9 + 7;
long long n, k;
double num[1 << 19];
long long quick(long long x, long long y) {
  long long u = 1;
  while (y) {
    if (y & 1) u *= x;
    x *= x;
    y >>= 1;
  }
  return u;
}
int main() {
  while (~scanf("%lld %lld", &n, &k)) {
    n = quick(2, n);
    double sum = 0;
    for (long long i = 0; i < n; i++) {
      scanf("%lf", &num[i]);
      sum += num[i];
    }
    printf("%.6f\n", sum / n);
    while (k--) {
      long long x;
      double y;
      scanf("%lld %lf", &x, &y);
      sum = sum + y - num[x];
      num[x] = y;
      printf("%.6f\n", sum / n);
    }
  }
  return 0;
}
