#include <bits/stdc++.h>
using namespace std;
const int MAXN = 6e5 + 51;
int n, r, pos, c;
long double res;
int x[MAXN];
inline int read() {
  register int num = 0, neg = 1;
  register char ch = getchar();
  while (!isdigit(ch) && ch != '-') {
    ch = getchar();
  }
  if (ch == '-') {
    neg = -1;
    ch = getchar();
  }
  while (isdigit(ch)) {
    num = (num << 3) + (num << 1) + (ch - '0');
    ch = getchar();
  }
  return num * neg;
}
int main() {
  n = 1 << read(), r = read();
  for (register int i = 0; i < n; i++) {
    x[i] = read(), res += x[i];
  }
  cout << fixed << setprecision(8) << res / n << endl;
  for (register int i = 1; i <= r; i++) {
    pos = read(), c = read(), res -= x[pos], res += (x[pos] = c);
    cout << fixed << setprecision(8) << res / n << endl;
  }
}
