#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using uint = unsigned int;
using ldb = long double;
struct init {
  init() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cout << fixed << setprecision(10);
  }
  ~init() {
    cerr << "Time elapsed: " << (double)clock() / CLOCKS_PER_SEC << "s.\n";
  }
} init;
const long long N = (1 << 20), MOD = 1000 * 1000 * 1000 + 7;
const ldb EPS = 5e-12, HALF = 0.5;
long long a[N];
long long sum;
signed main() {
  long long n, r;
  cin >> n >> r;
  for (auto i = (long long)0; i < (long long)(1 << n); ++i) {
    cin >> a[i];
    sum += a[i];
  }
  cout << sum / 1. / (1 << n) << '\n';
  while (r--) {
    long long x, g;
    cin >> x >> g;
    sum -= a[x];
    sum += g;
    a[x] = g;
    cout << sum / 1. / (1 << n) << '\n';
  }
}
