#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e6 + 50;
const int inf = 0x3f3f3f3f;
const long long INF = 0x3f3f3f3f3f3f3f3f;
const int mod = 998244353;
int c[maxn];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cout.setf(ios::fixed);
  int k, r;
  cin >> k >> r;
  int n = 1 << k;
  long long sum = 0;
  for (int i = 0; i < n; ++i) {
    cin >> c[i];
    sum += c[i];
  }
  cout << setprecision(8) << (double)sum / n << "\n";
  for (int i = 1; i <= r; ++i) {
    int pos, val;
    cin >> pos >> val;
    sum += val - c[pos];
    c[pos] = val;
    cout << setprecision(8) << (double)sum / n << "\n";
  }
  return 0;
}
