#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, r;
  double q;
  double sum, ans, x1, x2;
  while (scanf("%lld%lld", &n, &r) != EOF) {
    sum = 0;
    for (long long i = 0; i < 1 << n; i++) {
      scanf("%lf", &q);
      sum += q;
    }
    printf("%.7lf\n", sum / (1 << n));
    for (int i = 0; i < r; i++) {
      scanf("%lf%lf", &x1, &x2);
      sum = sum - x1 + x2;
      ans = sum / (1 << n);
      printf("%.7lf\n", ans);
    }
  }
  return 0;
}
