#include <bits/stdc++.h>
using namespace std;
long long MOD = 1000000007;
signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  long long N, R;
  cin >> N >> R;
  vector<long long> A(1 << N);
  long long res = 0;
  long long sum = 0;
  for (long long i = 0; i < (1 << N); i++) {
    cin >> A[i];
    sum += A[i];
  }
  long long a;
  long long b;
  cout << fixed << setprecision(15);
  cout << (double)sum / (1 << N) << endl;
  for (long long i = 0; i < R; i++) {
    cin >> a >> b;
    sum += b - A[a];
    A[a] = b;
    cout << (double)sum / (1 << N) << endl;
  }
}
