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