#include <bits/stdc++.h>
#pragma comment(linker, '/STACK:200000')
using namespace std;
const int M = 18;
const int N = 1 << 18;
int n, r;
double v[N];
int main() {
  scanf("%d %d", &n, &r);
  double ans = 0;
  int t = (1 << n);
  for (int i = 0; i < t; ++i) {
    scanf("%lf", v + i);
    ans += v[i];
  }
  printf("%.10lf\n", ans / (double)t);
  for (int i = 0; i < r; ++i) {
    int a, b;
    scanf("%d %d", &a, &b);
    ans -= v[a];
    v[a] = b;
    ans += v[a];
    printf("%.10lf\n", ans / (double)t);
  }
  return 0;
}
