#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
const long long mod = 1e9 + 7;
const int maxn = 1e6 + 5;
double a[maxn];
int main() {
  int n, q;
  while (cin >> n >> q) {
    double ans = 0.0;
    for (int i = 0; i < (1 << n); ++i) {
      scanf("%lf", a + i);
      ans += a[i];
    }
    printf("%.6f\n", ans / (1 << n));
    while (q--) {
      int x;
      double y;
      scanf("%d%lf", &x, &y);
      ans -= a[x];
      ans += y;
      a[x] = y;
      printf("%.6f\n", ans / (1 << n));
    }
  }
}
