#include <bits/stdc++.h>
using namespace std;
const int MAXN = 18;
int N, R;
long long val[1 << MAXN];
int main() {
  cin.tie(0);
  cin.sync_with_stdio(0);
  cin >> N >> R;
  long long sum = 0;
  for (int a = 0; a < (1 << N); a++) {
    cin >> val[a];
    sum += val[a];
  }
  cout << fixed << setprecision(15) << (double)sum / (1 << N) << "\n";
  while (R--) {
    long long Z, G;
    cin >> Z >> G;
    sum += G - val[Z];
    val[Z] = G;
    cout << fixed << setprecision(15) << (double)sum / (1 << N) << "\n";
  }
}
