#include <bits/stdc++.h>
using namespace std;
const int N = 300000 + 100;
const int oo = 1e9;
int n, a[N], r;
long long sum;
int main() {
  cin >> n >> r;
  for (int i = 0; i < 1 << n; ++i) {
    scanf("%d", &a[i]);
    sum += a[i];
  }
  for (int i = 0; i <= r; ++i) {
    if (i) {
      int u, v;
      scanf("%d%d", &u, &v);
      sum -= a[u];
      a[u] = v;
      sum += a[u];
    }
    double fn = sum / (double)(1 << n);
    printf("%.9lf\n", fn);
  }
  return 0;
}
