#include <bits/stdc++.h>
#pragma GCC optimize "Ofast"
#pragma GCC optimize "unroll-loops"
#pragma GCC target "sse,sse2,sse3,sse4,abm,avx,mmx,popcnt,tune=native"
char _;
using namespace std;
int n, r, z, g;
long long tot;
int c[300000];
int main() {
  cin.sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> r;
  for (int i = 0; i < (1 << n); i++) {
    cin >> c[i];
    tot += c[i];
  }
  cout << fixed << setprecision(10) << (1.0 * tot / (1 << n)) << "\n";
  for (int i = 0; i < r; i++) {
    cin >> z >> g;
    tot += g - c[z];
    c[z] = g;
    cout << fixed << setprecision(10) << (1.0 * tot / (1 << n)) << "\n";
  }
  return 0;
}
