#include <bits/stdc++.h>
using namespace std;
const long long int mod = 1e9 + 7;
const long long int inf = 1e9;
long long int c[1 << 18];
signed main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  long long int n, r, s = 0, z, g;
  cin >> n >> r;
  n = (1 << n);
  for (long long int i = 0; i < n; i++) {
    cin >> c[i];
    s += c[i];
  }
  cout << setprecision(10) << fixed;
  cout << 1.0 * s / n << endl;
  for (long long int i = 1; i <= r; i++) {
    cin >> z >> g;
    s -= c[z];
    c[z] = g;
    s += g;
    cout << 1.0 * s / n << endl;
  }
  return 0;
}
