#include <bits/stdc++.h>
using namespace std;
inline bool EQ(double a, double b) { return fabs(a - b) < 1e-9; }
const int INF = (((1 << 30) - 1) << 1) + 1;
const int nINF = 1 << 31;
const int N = 1 << 18;
long long n, r, a[N], s = 0, k;
int main() {
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(7);
  cin >> n >> r;
  k = 1 << n;
  for (int i = 0; i < (k); i++) {
    cin >> a[i];
    s += a[i];
  }
  cout << s / (double)k << endl;
  while (r--) {
    int i, v;
    cin >> i >> v;
    s += (v - a[i]);
    a[i] = v;
    cout << s / (double)k << endl;
  }
  return 0;
}
