#include <bits/stdc++.h>
using namespace std;
char hc;
template <class O>
inline void read(O &ie) {
  hc = getchar();
  ie = 0;
  for (; !isdigit(hc); hc = getchar())
    ;
  for (; isdigit(hc); hc = getchar()) ie = ie * 10 + (hc ^ 48);
  return;
}
const int MAX = 1e+9;
const int N = 3e+6 + 10;
int n;
long long nas, a[N], m, x, y;
signed main() {
  read(n);
  read(m);
  n = (1 << n);
  for (register int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
    nas += a[i];
  }
  printf("%.6f\n", (double)nas / (double)n);
  for (register int i = 1; i <= m; i++) {
    scanf("%d%d", &x, &y);
    nas = nas - a[x] + y;
    a[x] = y;
    printf("%.6f\n", (double)nas / (double)n);
  }
  exit(0);
}
