#include <bits/stdc++.h>
using namespace std;
const int N = 1 << 18 | 7;
const int M = 19;
int c[N];
int main() {
  int n, q;
  scanf("%d%d", &n, &q);
  long long ans = 0;
  for (int i = 0; i < 1 << n; i++) scanf("%d", c + i), ans += c[i];
  printf("%.7f\n", 1.0 * ans / (1 << n));
  for (int i = 0, x, y; i < q; i++) {
    scanf("%d%d", &x, &y);
    ans -= c[x], ans += y;
    c[x] = y;
    printf("%.7f\n", 1.0 * ans / (1 << n));
  }
  return 0;
}
