#include <bits/stdc++.h>
const int MAXN = 1 << 18;
int read() {
  int x = 0;
  char c = getchar();
  bool f = 0;
  while (c < '0' || c > '9') (c == '-') ? f = 1, c = getchar() : c = getchar();
  while (c >= '0' && c <= '9')
    x = (x << 1) + (x << 3) + (48 ^ c), c = getchar();
  return (f) ? -x : x;
}
int c[MAXN];
int main() {
  int n = read(), r = read();
  int pow = 1 << n;
  long long sum = 0;
  for (int i = 0; i < pow; ++i) {
    c[i] = read();
    sum += c[i];
  }
  printf("%.6lf\n", sum * 1.0 / pow);
  for (int t = 0; t < r; ++t) {
    int z = read(), g = read();
    sum = sum - c[z] + g;
    c[z] = g;
    printf("%.6lf\n", sum * 1.0 / pow);
  }
}
