#include <bits/stdc++.h>
using namespace std;
const int N = 20;
int n, r, x, v;
long long a[1 << N], tot;
int main(int argc, char const *argv[]) {
  cin >> n >> r;
  for (int i = 1; i <= (1 << n); i++) cin >> a[i], tot += a[i];
  printf("%.8lf\n", tot * 1.0 / (1ll << n));
  while (r--) {
    cin >> x >> v, tot -= a[x + 1], a[x + 1] = v, tot += v;
    printf("%.8lf\n", tot * 1.0 / (1ll << n));
  }
  return 0;
}
