#include <bits/stdc++.h>
int main() {
  int n, r;
  std::cin >> n >> r;
  size_t f_size = 1;
  for (size_t i = 0; i < n; ++i) {
    f_size *= 2;
  }
  std::vector<int> f(f_size);
  double expect = 0;
  for (size_t i = 0; i < f_size; ++i) {
    std::cin >> f[i];
    expect += f[i];
  }
  expect /= f_size;
  std::cout << std::fixed << std::setprecision(10) << expect << "\n";
  for (size_t game = 0; game < r; ++game) {
    int z, g;
    std::cin >> z >> g;
    expect = expect + (-1. * f[z] + g) / f_size;
    f[z] = g;
    std::cout << std::fixed << std::setprecision(10) << expect << "\n";
  }
  return 0;
}
