#include <bits/stdc++.h>
using namespace std;
vector<long long> v;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long a = 0, b = 0, c, d, e, f = 0, l, g, m, n, k, i, j, t, p, q, r;
  cin >> n >> r;
  l = powl(2.0, n);
  long double ans = 0;
  for (i = 0; i < l; i++) {
    cin >> a;
    v.push_back(a);
    ans += a;
  }
  ans /= l;
  cout << fixed << setprecision(10) << ans << '\n';
  while (r--) {
    cin >> a >> b;
    ans -= (1.0 * v[a] / l);
    ans += (1.0 * b / l);
    v[a] = b;
    cout << fixed << setprecision(10) << ans << '\n';
  }
  return 0;
}
