#include <bits/stdc++.h>
using namespace std;
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << " : " << arg1 << " | ";
  __f(comma + 1, args...);
}
const int N = 1e5 + 5;
int A[1 << 19];
double sum = 0;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ;
  int n, q;
  cin >> n >> q;
  n = 1 << n;
  for (int i = 0; i < n; i++) {
    cin >> A[i];
    sum += A[i];
  }
  cout << fixed << setprecision(10) << sum / n << "\n";
  while (q--) {
    int id;
    cin >> id;
    sum -= A[id];
    cin >> A[id];
    sum += A[id];
    cout << fixed << setprecision(10) << sum / n << "\n";
  }
  return 0;
}
