#include <bits/stdc++.h>
using namespace std;
int a[(1 << 18) + 5], n, r;
long long ans;
double v;
int main() {
  scanf("%d%d", &n, &r);
  for (int q = 0; q < (1 << n); q++) {
    scanf("%d", &a[q]);
    ans += a[q];
  }
  v = 1 << n;
  printf("%0.8f\n", ans / v);
  for (int q = 0; q < r; q++) {
    int z;
    scanf("%d", &z);
    ans -= a[z];
    scanf("%d", &a[z]);
    ans += a[z];
    printf("%0.8f\n", ans / v);
  }
  return 0;
}
