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