#include <bits/stdc++.h>
using namespace std;
long long n, m, a[1000005], ans = 0;
inline long long read() {
  long long red = 0, f_f = 1;
  char ch = getchar();
  while (ch > '9' || ch < '0') {
    if (ch == '-') f_f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') red = red * 10 + ch - '0', ch = getchar();
  return red * f_f;
}
signed main() {
  n = (1ll << read()), m = read();
  for (long long i = 0; i < n; i++) a[i] = read(), ans += a[i];
  printf("%.6lf\n", 1.0 * ans / n);
  while (m--) {
    long long x = read(), y = read();
    ans -= a[x];
    a[x] = y;
    ans += a[x];
    printf("%.6lf\n", 1.0 * ans / n);
  }
  return 0;
}
