#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1 << 18;
int a[MAXN + 1];
int main() {
  double s;
  int n, q, x, y, i;
  cin >> n >> q;
  s = 0;
  n = (1 << n);
  for (i = 0; i < n; i++) {
    cin >> a[i];
    s = s + a[i];
  }
  cout << setprecision(10) << s / n << '\n';
  while (q--) {
    cin >> x >> y;
    s = s - a[x];
    a[x] = y;
    s = s + a[x];
    cout << setprecision(10) << s / n << '\n';
  }
  return 0;
}
