#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
ll x[1 << 18];
void safeout(long long sum, long long m) {
  using ld = long double;
  long long f = sum / m;
  ld s = ld(sum % m) / (ld)m;
  if (f >= 10) {
    s += sum % 10;
    cout << f / 10 << s << 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);
  safeout(sum, m);
  for (int i = 0; i < r; i++) {
    ll a, b;
    cin >> a >> b;
    sum -= x[a];
    x[a] = b;
    sum += x[a];
    safeout(sum, m);
  }
}
