#include <bits/stdc++.h>
using namespace std;
const long double eps = 1e-13;
const long double PI = acos(-1);
const int INF = (int)1e9;
const long long INFF = (long long)1e18;
const int mod = (int)1e9 + 7;
const int MXN = (int)5e5 + 7;
int a[MXN];
int main() {
  int n, r;
  scanf("%d %d", &n, &r);
  for (int i = 0; i < 1 << n; i++) scanf("%d", a + i);
  long double sum = 0;
  for (int i = 0; i < 1 << n; i++) sum += a[i];
  long long bs = 1 << n;
  printf("%.13Lf\n", sum / bs);
  while (r--) {
    int p, v;
    scanf("%d %d", &p, &v);
    sum += (v - a[p]);
    a[p] = v;
    printf("%.13Lf\n", sum / bs);
  }
  return 0;
}
