#include <bits/stdc++.h>
long long a[1 << 18], n, k, x, y, s;
int main() {
  for (scanf("%d%d", &n, &k); x < (1 << n); s += a[x++]) scanf("%d", a + x);
  for (; printf("%.9f\n", 1.0 * s / (1 << n)) && k--; s -= a[y], s += a[y] = x)
    scanf("%d%d", &y, &x);
}
