#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 5;
int a[N];
int main() {
  int n, r;
  scanf("%d %d", &n, &r);
  long long ans = 0LL;
  for (int i = 0; i <= (1 << n) - 1; i++) scanf("%d", &a[i]), ans += a[i];
  printf("%.8f\n", (double)((double)(ans) / (double)((1 << n))));
  for (int i = 1; i <= r; i++) {
    int x, val;
    scanf("%d %d", &x, &val);
    ans -= a[x];
    a[x] = val;
    ans += a[x];
    printf("%.8f\n", ((double)(ans) / (double)((1 << n))));
  }
  return 0;
}
