#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, r;
  cin >> n >> r;
  vector<double> a(1 << n);
  double sum = 0, div = (double)(1 << n);
  for (int i = 0; i < (1 << n); i++) {
    int x;
    cin >> x;
    a[i] = (double)x;
    sum += a[i];
  }
  double ans = sum / div;
  cout << setprecision(7) << fixed << ans << '\n';
  while (r--) {
    int z, g;
    cin >> z >> g;
    double gg = (double)g;
    sum += (gg - a[z]);
    a[z] = gg;
    ans = sum / div;
    cout << setprecision(7) << fixed << ans << '\n';
  }
  return 0;
}
