#include <bits/stdc++.h>
using namespace std;
template <typename T>
void out(T x) {
  cout << x << endl;
  exit(0);
}
using ll = long long;
using ld = long double;
const int maxn = 1e6 + 5;
int n, r;
ll c[maxn];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cout << fixed << setprecision(10);
  ll sum = 0;
  cin >> n >> r;
  for (int i = 0; i < 1 << n; i++) {
    cin >> c[i];
    sum += c[i];
  }
  ld res = 1.0 * sum / (1 << n);
  cout << res << "\n";
  while (r--) {
    int i, g;
    cin >> i >> g;
    sum -= c[i];
    c[i] = g;
    sum += c[i];
    ld res = 1.0 * sum / (1 << n);
    cout << res << "\n";
  }
  return 0;
}
