#include <bits/stdc++.h>
using namespace std;
template <typename T>
void dbg(T a) {}
template <typename T, typename... Arg>
void dbg(T a, Arg... arg) {}
const int maxn = (1e6) + 7;
const int maxk = 20;
const int inf = (1e9) + 7;
const long long LLinf = (1e18) + 7;
const long double eps = 1e-9;
const long long mod = 1e9 + 7;
long long tab[maxn];
long long suma;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n, q;
  cin >> n >> q;
  for (int i = 0; i < (1 << n); i++) {
    cin >> tab[i];
    suma += tab[i];
  }
  cout << fixed << setprecision(20) << (long double)suma / (long double)(1 << n)
       << "\n";
  while (q--) {
    int pos;
    long long val;
    cin >> pos >> val;
    suma -= tab[pos];
    suma += val;
    tab[pos] = val;
    cout << fixed << setprecision(20)
         << (long double)suma / (long double)(1 << n) << "\n";
  }
  return 0;
}
