#include <bits/stdc++.h>
using namespace std;
const double PI = 2 * acos(0.0), eps = 1e-8;
const long long oo = 1000000000000000000;
template <class T>
void show(const vector<T> &a) {
  cout << ((long long)(a.size())) << endl;
  for (T first : a) cout << first << " ";
  cout << endl;
}
const long long M = 998244353;
long long MOD(long long a) {
  if (a >= 0) return a >= M ? a % M : a;
  if (a <= -M) a %= M;
  return a ? a + M : a;
}
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long n, r, t, q, sum = 0;
  cin >> n >> r;
  vector<long long> v(1LL << n);
  double p = 1.0;
  for (long long i = 0; i < n; i++) {
    p *= 0.5;
  }
  for (long long i = 0; i < (1LL << n); i++) {
    cin >> v[i];
    sum += v[i];
  }
  cout << setprecision(8) << fixed;
  cout << (double)sum * p << endl;
  for (long long i = 0; i < r; i++) {
    cin >> t >> q;
    sum += q - v[t];
    v[t] = q;
    cout << (double)sum * p << endl;
  }
}
