#include <bits/stdc++.h>
using namespace std;
int main() {
  std::ios_base::sync_with_stdio(false);
  std::cin.tie(nullptr);
  long long n, r;
  cin >> n >> r;
  vector<int> v;
  double rows = pow(2, n);
  double sum = 0;
  for (long long i = 0; i < rows; ++i) {
    int k;
    cin >> k;
    sum += k;
    v.push_back(k);
  }
  cout << setprecision(20) << sum / rows << '\n';
  for (int i = 0; i < r; ++i) {
    int pos, val;
    cin >> pos >> val;
    int dif = val - v[pos];
    v[pos] = val;
    sum += dif;
    cout << setprecision(20) << sum / rows << '\n';
  }
  return 0;
}
