#include <bits/stdc++.h>
using namespace std;
int n, r;
long long c[1 << 19];
int main() {
  while (scanf("%d%d", &n, &r) != EOF) {
    int nn = 1 << n;
    long long sum = 0;
    for (int i = 0; i < nn; ++i) {
      scanf("%lld", &c[i]);
      sum += c[i];
    }
    printf("%.8f\n", 1.0 * sum / nn);
    while (r--) {
      int x;
      long long y;
      scanf("%d%lld", &x, &y);
      sum += (y - c[x]);
      printf("%.8f\n", 1.0 * sum / nn);
      c[x] = y;
    }
  }
}
