#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 5;
int n;
long long r, a[(1LL << 20)], x, y;
int main() {
  scanf("%d %I64d", &n, &r);
  long long sum = 0;
  double qpw = 1;
  for (int i = 1; i <= n; ++i) qpw *= 2;
  for (int i = 1; i <= qpw; ++i) {
    scanf("%I64d", &a[i]);
    sum += a[i];
  }
  printf("%.6f\n", sum * 1.0 / qpw);
  double ans = 0;
  while (r--) {
    scanf("%I64d %I64d", &x, &y);
    sum += (y - a[x + 1]);
    a[x + 1] = y;
    ans = sum * 1.0 / qpw;
    printf("%.6f\n", ans);
  }
  return 0;
}
