#include <bits/stdc++.h>
using namespace std;
const int N = (1 << 18);
long long n, r, all, c[N];
void solve() {
  cin >> n >> r;
  for (int i = 0; i < (1 << n); ++i) {
    cin >> c[i];
    all += c[i];
  }
  cout << setprecision(6) << fixed << all / (long double)(1 << n) << "\n";
  for (int i = 0; i < r; ++i) {
    long long z, g;
    cin >> z >> g;
    all += g - c[z];
    c[z] = g;
    cout << setprecision(6) << fixed << all / (long double)(1 << n) << "\n";
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  solve();
  return 0;
}
