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