#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout << fixed << setprecision(12);
  int n, r;
  cin >> n >> r;
  int sz = (1 << n);
  int c[sz];
  long long sum = 0;
  for (int i = 0; i < sz; i++) {
    cin >> c[i];
    sum += c[i];
  }
  double ans = (1.0 * sum) / sz;
  cout << ans << "\n";
  while (r--) {
    int z, g;
    cin >> z >> g;
    sum += g;
    sum -= c[z];
    cout << (1.0 * sum) / sz << "\n";
    c[z] = g;
  }
  return 0;
}
