#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
const long long mod = 1e9 + 7;
const int maxn = 1e6 + 10;
const int inf = 0x3f3f3f3f;
int T;
int n, c[maxn], q;
int main() {
  while (~scanf("%d%d", &n, &q)) {
    long long sum = 0;
    n = pow(2, n);
    for (int i = 0; i <= n - 1; i++) {
      scanf("%d", &c[i]);
      sum += c[i];
    }
    printf("%.15lf\n", 1.0 * sum / n);
    int a, b;
    while (q--) {
      scanf("%d%d", &a, &b);
      sum = sum - c[a] + b;
      c[a] = b;
      printf("%.15lf\n", 1.0 * sum / n);
    }
  }
  return 0;
}
