#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e6;
int n, r, c[maxn];
int main(void) {
  cin >> n >> r;
  int nm = (1 << n);
  double rt = 0.0;
  for (int i = 0; i < (1 << n); ++i) {
    scanf("%d", &c[i]);
    rt += double(c[i]) / nm;
  }
  printf("%.8f\n", rt);
  for (int i = 0; i < r; ++i) {
    int z, g;
    scanf("%d%d", &z, &g);
    rt -= (double(c[z] - g) / nm);
    c[z] = g;
    printf("%.8f\n", rt);
  }
}
