#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimize("no-stack-protector")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
int32_t main() {
  cout.precision(20);
  long long n, r;
  cin >> n >> r;
  vector<long long> num(pow(2, n));
  long long sum = 0;
  for (long long i = 0; i < pow(2, n); i++) {
    cin >> num[i];
    sum += num[i];
  }
  long double ans = (long double)sum / (long double)num.size();
  cout << ans << "\n";
  for (long long i = 0; i < r; i++) {
    long long pos, x;
    cin >> pos >> x;
    sum = sum + x - num[pos];
    num[pos] = x;
    cout << (long double)sum / (long double)num.size() << "\n";
  }
  return 0;
}
