#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 5;
int C[N];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n, r;
  cin >> n >> r;
  double sum = 0;
  for (int i = 0; i < (1 << n); i++) {
    cin >> C[i];
    sum += C[i];
  }
  cout << setprecision(15) << fixed << sum / (1 << n) << "\n";
  while (r--) {
    int z, g;
    cin >> z >> g;
    sum += g - C[z];
    C[z] = g;
    cout << setprecision(15) << fixed << sum / (1 << n) << "\n";
  }
  return 0;
}
