#include <bits/stdc++.h>
using namespace std;
int c[500000];
int main() {
  int n, r;
  scanf("%d%d", &n, &r);
  int cnt = 1;
  for (int i = 0; i < n; i++) {
    cnt *= 2;
  }
  long long summ = 0;
  for (int i = 0; i < cnt; i++) {
    scanf("%d", &c[i]);
    summ += c[i];
  }
  printf("%lf\n", (double)summ / cnt);
  for (int i = 0; i < r; i++) {
    int z, g;
    scanf("%d%d", &z, &g);
    summ -= c[z];
    c[z] = g;
    summ += c[z];
    printf("%lf\n", (double)summ / cnt);
  }
  return 0;
}
