#include <bits/stdc++.h>
using namespace std;
int main(int argc, char const *argv[]) {
  int n, k;
  cin >> n >> k;
  n = (1 << n);
  vector<long double> v(n);
  long double sum = 0;
  for (int i = 0; i < n; i++) {
    cin >> v[i];
    sum += v[i];
  }
  printf("%.8lf\n", sum / n);
  int a;
  long double c;
  while (k--) {
    cin >> a >> c;
    sum += c - v[a];
    v[a] = c;
    long double res = sum / n;
    printf("%.8lf\n", res);
  }
  return 0;
}
