#include <bits/stdc++.h>
using namespace std;
int main() {
  std::ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n, r;
  cin >> n >> r;
  int N = n;
  n = (1 << n);
  vector<long long> data(n);
  for (int i = 0; i < n; i++) cin >> data[i];
  long long sum = 0;
  double invN = 1 / double(n);
  for (int i = 0; i < n; i++) sum += data[i];
  cout << setprecision(10) << fixed;
  cout << double(sum) / (1 << N) << "\n";
  for (int i = 0; i < r; i++) {
    int idx;
    long long val;
    cin >> idx >> val;
    sum -= data[idx];
    sum += val;
    data[idx] = val;
    cout << double(sum) / (1 << N) << "\n";
  }
  return 0;
}
