#include <bits/stdc++.h>
using namespace std;
int n, r, c[262144], z, g;
double ans;
int main() {
  scanf("%d%d", &n, &r), n = 1 << n;
  for (int i = 0; i < n; i++) scanf("%d", &c[i]), ans += 1.0 * c[i] / n;
  printf("%.6f\n", ans);
  for (int i = 0; i < r; i++)
    scanf("%d%d", &z, &g), ans += 1.0 * (g - c[z]) / n, c[z] = g,
                                                        printf("%.6f\n", ans);
}
