#include <bits/stdc++.h>
using namespace std;
const int N = 1 << 19;
int n, q, a[N];
long long s;
int main() {
  int i, x, y;
  scanf("%d%d", &n, &q);
  n = 1 << n;
  for (i = 0; i < n; i = i + 1) scanf("%d", a + i), s += a[i];
  for (i = 0; i <= q; i = i + 1) {
    if (i) {
      scanf("%d%d", &x, &y);
      s -= a[x];
      a[x] = y;
      s += a[x];
    }
    printf("%.9f\n", (double)s / n);
  }
  return 0;
}
