#include <bits/stdc++.h>
using namespace std;
const int MAX_BITS = 18;
const int MAX_N = 1 << MAX_BITS;
int val[MAX_N + 1];
long long int bit[MAX_N + 1];
int N, bits;
int rightmost(int index) { return index & (-index); }
long long int prefixSum(int index) {
  long long int sum = 0LL;
  while (index > 0) {
    sum += bit[index];
    index -= rightmost(index);
  }
  return sum;
}
long long int update(int index, int delta) {
  while (index <= N) {
    bit[index] += delta;
    index += rightmost(index);
  }
}
void answer() { cout << prefixSum(N) / (double)N << '\n'; }
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout << fixed;
  cout.precision(6);
  int R;
  cin >> bits >> R;
  N = 1 << bits;
  for (int i = 1; i <= N; ++i) {
    cin >> val[i];
    update(i, val[i]);
  }
  answer();
  for (int i = 0; i < R; ++i) {
    int index, value;
    cin >> index >> value;
    ++index;
    update(index, value - val[index]);
    answer();
  }
  return 0;
}
