#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1 << 18 + 5;
int n, r;
double c[MAXN];
double ans, sum;
int main() {
  cin >> n >> r;
  int cnt = 1 << n;
  for (int i = 0; i < cnt; i++) {
    scanf("%lf", &c[i]);
    sum += c[i];
  }
  ans = sum / cnt;
  printf("%.7lf\n", ans);
  int a, b;
  while (r--) {
    scanf("%d%d", &a, &b);
    sum -= c[a];
    c[a] = b;
    sum += b;
    ans = sum / cnt;
    printf("%.7lf\n", ans);
  }
}
