#include <bits/stdc++.h>
int val[262149];
int main() {
  int n, r;
  scanf("%d%d", &n, &r);
  long long sum(0LL);
  for (int i = 0; i < (1 << n); i++) {
    scanf("%d", &val[i]);
    sum += val[i];
  }
  printf("%.10lf\n", (sum * 1.0) / (1 << n));
  for (int i = 0; i < r; i++) {
    int a, b;
    scanf("%d%d", &a, &b);
    sum += b - val[a];
    printf("%.10lf\n", (sum * 1.0) / (1 << n));
    val[a] = b;
  }
  return 0;
}
