#include <bits/stdc++.h>
using namespace std;
const int inf = 0x7fffffff;
const double eps = 1e-10;
const double pi = acos(-1.0);
inline int read() {
  int x = 0, f = 1;
  char ch;
  ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = 0;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = (x << 1) + (x << 3) + (ch & 15);
    ch = getchar();
  }
  if (f)
    return x;
  else
    return -x;
}
int n, lim, m, o;
long long a[(1 << 18) + 10], f, sum;
int main() {
  n = read();
  lim = 1 << n;
  m = read();
  for (int i = 0; i < lim; i++) scanf("%I64d", &a[i]), sum += a[i];
  printf("%lf\n", 1.0 * sum / lim);
  while (m--) {
    o = read();
    scanf("%I64d", &f);
    sum += (f - a[o]);
    a[o] = f;
    printf("%lf\n", 1.0 * sum / lim);
  }
  return 0;
}
