#include <bits/stdc++.h>
using namespace std;
inline int myrand(int l, int r) {
  int ret = rand();
  ret <<= 15;
  ret ^= rand();
  if (ret < 0) ret = -ret;
  ret %= (r - l + 1);
  ret += l;
  return ret;
}
template <typename F, typename S>
ostream& operator<<(ostream& os, const pair<F, S>& p) {
  return os << "(" << p.first << ", " << p.second << ")";
}
template <typename T>
using min_pq = priority_queue<T, vector<T>, greater<T> >;
int n, r;
double a[1 << 18];
int32_t main() {
  scanf("%d %d", &n, &r);
  for (int i = 0; i < (1 << n); i++) {
    scanf("%lf", &a[i]);
  }
  double s = 0;
  for (int i = 0; i < (1 << n); i++) {
    s += a[i];
  }
  printf("%.10lf\n", s / double(1 << n));
  while (r--) {
    int i;
    double x;
    scanf("%d %lf", &i, &x);
    s -= a[i];
    a[i] = x;
    s += a[i];
    printf("%.10lf\n", s / double(1 << n));
  }
}
