#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n, r;
  cin >> n >> r;
  long double res = 0;
  vector<int> v(1 << n);
  for (int i = 0; i < (int)1 << n; i++) {
    cin >> v[i];
    res += v[i];
  }
  long double pw = 1;
  for (int i = 0; i < (int)n; i++) pw *= 1.0 / 2;
  cout << setprecision(8) << fixed << res * pw << "\n";
  while (r--) {
    int z, g;
    cin >> z >> g;
    res -= v[z];
    res += g;
    v[z] = g;
    cout << res * pw << "\n";
  }
}
