#include <bits/stdc++.h>
using namespace std;
inline long long read() {
  long long x = 0, f = 1;
  char c = getchar();
  while ((c < '0' || c > '9') && (c != '-')) c = getchar();
  if (c == '-') f = -1, c = getchar();
  while (c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();
  return x * f;
}
const int N = 1 << 18 | 3;
int n, q, a[N];
long long s;
int main() {
  n = read(), q = read();
  for (register int i = (0); i < (1 << n); i++) a[i] = read(), s += a[i];
  printf("%lf\n", 1.0 * s / (1 << n));
  while (q--) {
    int x = read(), y = read();
    s -= a[x], s += y, a[x] = y;
    printf("%lf\n", 1.0 * s / (1 << n));
  }
}
