#include <bits/stdc++.h>
using namespace std;
int n, r;
long long f[(1 << 18) + 1];
long long sum(int up) {
  long long ans = 0;
  for (int i = 0; i <= up - 1; ++i) ans += f[i];
  return ans;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin >> n >> r;
  int nos = 1 << n;
  int up = nos;
  for (int i = 0; i <= up - 1; ++i) cin >> f[i];
  long long t = sum(nos);
  cout << std::setprecision(9) << (double)t / (nos) << "\n";
  for (int i = 1; i <= r; ++i) {
    long long z, g;
    cin >> z >> g;
    long long change = g - f[z];
    t += change;
    cout.precision(9);
    cout << std::setprecision(9) << (double)t / nos << "\n";
    f[z] = g;
  }
  return 0;
}
