#include <bits/stdc++.h>
using namespace std;
using LL = long long;
using LD = long double;
const int MX = 1 << 18 | 3;
int N, a[MX], Q;
LL sum;
int main() {
  ios::sync_with_stdio(0);
  cout << fixed << setprecision(10);
  cin >> N >> Q;
  for (int i = 0; i < (1 << N); i++) cin >> a[i], sum += a[i];
  cout << (LD)sum / (1 << N) << "\n";
  while (Q--) {
    int u, x;
    cin >> u >> x;
    sum = sum - a[u] + x;
    a[u] = x;
    cout << (LD)sum / (1 << N) << "\n";
  }
  return 0;
}
