#include <bits/stdc++.h>
using namespace std;
const int N = 1000000;
int n, cq, a[N + 9];
long long sum;
void into() {
  scanf("%d%d", &n, &cq);
  for (int i = 0; i < 1 << n; ++i) {
    scanf("%d", &a[i]);
    sum += a[i];
  }
}
void Get_ans() {
  printf("%.10lf\n", 1.0 * sum / (1 << n));
  for (; cq--;) {
    int p, x;
    scanf("%d%d", &p, &x);
    sum -= a[p];
    sum += a[p] = x;
    printf("%.10lf\n", 1.0 * sum / (1 << n));
  }
}
void work() { Get_ans(); }
void outo() {}
int main() {
  int T = 1;
  for (; T--;) {
    into();
    work();
    outo();
  }
  return 0;
}
