#include <bits/stdc++.h>
int n, r, a[(1 << 18) + 5];
long long ans;
int main() {
  scanf("%d%d", &n, &r);
  for (int i = 0; i < (1 << n); ++i) scanf("%d", &a[i]), ans += a[i];
  double w = 1 << n;
  printf("%.10f\n", ans / w);
  for (int p, i = 0; i < r; ++i) {
    scanf("%d", &p);
    ans -= a[p];
    scanf("%d", &a[p]);
    ans += a[p];
    printf("%.10f\n", ans / w);
  }
  return 0;
}
