#include <bits/stdc++.h>
using namespace std;
int n, r, a[(1 << 18)];
double sum;
inline int read() {
  register int w = 0, X = 0;
  register char ch = 0;
  while (!isdigit(ch)) {
    w |= ch == '-';
    ch = getchar();
  }
  while (isdigit(ch)) {
    X = (X << 1) + (X << 3) + (ch ^ 48);
    ch = getchar();
  }
  return w ? -X : X;
}
int main() {
  n = read(), r = read();
  for (register int i = 0; i < (1 << n); i++) sum += (a[i] = read());
  printf("%.10lf\n", sum / (1 << n));
  for (register int i = 1; i <= r; i++) {
    register int z = read(), d = read();
    sum -= a[z];
    sum += (a[z] = d);
    printf("%.10lf\n", sum / (1 << n));
  }
  return 0;
}
