#include <bits/stdc++.h>
int main(int argc, char **argv) {
  int n, r;
  std::cin >> n >> r;
  int s = pow(2, n);
  std::vector<uint64_t> values(s);
  for (int i = 0; i < values.size(); ++i) {
    std::cin >> values[i];
  }
  uint64_t sum = std::accumulate(values.begin(), values.end(), (uint64_t)0);
  double avg = (double)sum / s;
  std::cout << std::setprecision(6) << avg << '\n';
  for (int i = 1; i <= r; ++i) {
    int index;
    uint64_t new_val;
    std::cin >> index >> new_val;
    uint64_t current_val = values[index];
    if (new_val != current_val) {
      uint64_t diff = new_val - current_val;
      uint64_t new_sum = sum + diff;
      values[index] = new_val;
      avg = (double)new_sum / s;
      sum = new_sum;
    }
    if (avg > 1000000.0) {
      uint64_t avg_rounded = (uint64_t)avg;
      std::cout << avg_rounded << '\n';
    } else {
      std::cout << std::setprecision(17) << avg << "\n";
    }
  }
}
