#include <bits/stdc++.h>
using namespace std;
using ll = long long int;
using ull = unsigned long long int;
using dd = double;
using ldd = long double;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  ll n, r;
  cin >> n >> r;
  vector<ll> arr((ll(1)) << n);
  ll sum = 0;
  n = ((ll)1) << n;
  for (int i = 0; i < n; ++i) {
    cin >> arr[i];
    sum += arr[i];
  }
  cout.precision(10);
  cout << ((dd)sum) / (dd(n)) << '\n';
  for (int i = 0; i < r; ++i) {
    ll a, b;
    cin >> a >> b;
    sum -= arr[a];
    sum += b;
    arr[a] = b;
    cout << ((dd)sum) / (dd(n)) << '\n';
  }
}
