#include <bits/stdc++.h>
using namespace std;
signed main() {
  long long n, q;
  double res = 0.0;
  cin >> n >> q;
  vector<long long> a(1 << n);
  for (long long i = 0; i < (1 << n); i++) cin >> a[i];
  for (long long i = 0; i < a.size(); i++) res += a[i];
  cout << fixed << setprecision(10);
  cout << (res / (1 << n)) << '\n';
  while (q--) {
    long long x, val;
    cin >> x >> val;
    res += val - a[x];
    a[x] = val;
    cout << (res / (1 << n)) << '\n';
  }
  return 0;
}
