#include <bits/stdc++.h>
using namespace std;
const int maxn = 1000010;
double a[maxn], ans = 0, g;
int n, r, nn, z;
int main() {
  scanf("%d%d", &n, &r);
  nn = 1 << n;
  for (int i = 0; i < nn; i++) scanf("%lf", &a[i]), ans += a[i];
  printf("%.8lf\n", ans / nn);
  for (int i = 0; i < r; i++) {
    scanf("%d%lf", &z, &g);
    ans = ans - a[z] + g, a[z] = g;
    printf("%.8lf\n", ans / nn);
  }
  return 0;
}
