#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
ll x[1 << 18];
void out(ll sum, ll m) {
  ll f = sum / m;
  ld s = ld(sum % m) / (ld)m;
  if (f >= 10) {
    s += sum % 10;
    cout << f / 10 << (ld)s / (ld)m << endl;
  } else {
    cout << (ld)sum / (ld)m << endl;
  }
}
int main() {
  ios::sync_with_stdio(false), cin.tie(0);
  ll n, r;
  cin >> n >> r;
  ll m = 1 << n;
  ll sum = 0;
  for (int i = 0; i < m; i++) cin >> x[i], sum += x[i];
  cout << fixed << setprecision(7);
  out(sum, m);
  for (int i = 0; i < r; i++) {
    ll a, b;
    cin >> a >> b;
    sum -= x[a];
    x[a] = b;
    sum += x[a];
    out(sum, m);
  }
}
