#include <bits/stdc++.h>
using namespace std;
int a[2333333];
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  n = (1 << n);
  double sum = 0;
  for (int i = 0; i < n; i++) scanf("%d", &a[i]), sum += a[i];
  printf("%.6f\n", sum / n);
  for (int i = 0; i < m; i++) {
    int p, x;
    scanf("%d%d", &p, &x);
    sum -= a[p];
    sum += x;
    a[p] = x;
    printf("%.6f\n", sum / n);
  }
  return 0;
}
