#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("-O2")
const int LIM = 1e5 + 5, MOD = 1e9 + 7;
int n;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  long long a = (1 << n);
  long double divv = a;
  long long sum = 0, r, x, y;
  long long A[a + 5];
  cin >> r;
  for (int i = 0; i < a; i++) {
    cin >> A[i];
    sum += A[i];
  }
  cout << setprecision(10) << fixed;
  cout << sum / divv << "\n";
  for (int i = 0; i < r; i++) {
    cin >> x >> y;
    sum -= A[x];
    sum += y;
    A[x] = y;
    cout << sum / divv << "\n";
  }
  return 0;
}
