#include <bits/stdc++.h>
using namespace std;
const int MAXN = 5e5 + 5;
template <typename T>
void chkmax(T& x, T y) {
  if (y > x) x = y;
}
template <typename T>
void chkmin(T& x, T y) {
  if (y < x) x = y;
}
int N, Q, a[1 << 18];
long long sum;
int main() {
  scanf("%d%d", &N, &Q);
  for (int i = 0; i < (1 << N); ++i) scanf("%d", &a[i]), sum += a[i];
  printf("%.7f\n", sum / (double)(1 << N));
  while (Q--) {
    int p, x;
    scanf("%d%d", &p, &x), sum -= a[p], a[p] = x, sum += a[p];
    printf("%.7f\n", sum / (double)(1 << N));
  }
  return 0;
}
