#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  ios::sync_with_stdio(false);
  int n, q;
  cin >> n >> q;
  vector<long long> tab(1LL << n);
  long long sum = 0;
  for (int i = 0; i < (1 << n); i++) {
    cin >> tab[i];
    sum += tab[i];
  }
  long double val = (1LL << n);
  cout.precision(8);
  cout << fixed << sum / val << endl;
  while (q-- > 0) {
    long long x, v;
    cin >> x >> v;
    sum += v - tab[x];
    tab[x] = v;
    cout.precision(8);
    cout << fixed << sum / val << endl;
  }
}
