#include <bits/stdc++.h>
using namespace std;
int main(int argc, char **argv) {
  std::ios::sync_with_stdio(false);
  int n, r;
  cin >> n >> r;
  vector<long long> vec(1 << n);
  long long sum = 0;
  for (auto &v : vec) {
    cin >> v;
    sum += v;
  }
  cout << sum / double(1 << n) << '\n';
  int a, b;
  for (size_t i = 0; i < r; ++i) {
    cin >> a >> b;
    sum += (b - vec[a]);
    vec[a] = b;
    cout << fixed << setprecision(10) << sum / double(1 << n) << '\n';
  }
  return 0;
}
