#include <bits/stdc++.h>
using namespace std;
const int MAXN = (1 << 18);
long long c[MAXN + 5], sum;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int N, K;
  cin >> N >> K;
  for (int i = 0; i < (1 << N); i++) {
    cin >> c[i];
    sum += c[i];
  }
  cout << fixed << setprecision(6) << (double)sum / (1 << N) << '\n';
  for (int i = 0; i < K; i++) {
    long long id, x;
    cin >> id >> x;
    sum -= c[id];
    c[id] = x;
    sum += x;
    cout << fixed << setprecision(6) << (double)sum / (1 << N) << '\n';
  }
}
