#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n, r;
  cin >> n >> r;
  long double d = pow(2, -n);
  ll sum = 0;
  vector<ll> c(n);
  for (int i = 0; i < (1 << n); ++i) {
    cin >> c[i];
    sum += c[i];
  }
  cout << d << ' ' << sum << '\n';
  for (int i = 0; i < r; ++i) {
    cout << fixed << setprecision(22) << sum * d << '\n';
    int z, g;
    cin >> z >> g;
    ll old = c[z];
    sum = sum - old + g;
    c[z] = g;
  }
  cout << fixed << setprecision(22) << sum * d << "\n";
  return 0;
}
