#include <bits/stdc++.h>
using namespace std;
long long f[300005];
int main() {
  ios::sync_with_stdio(false);
  int n, r;
  cin >> n >> r;
  double sum = 0;
  for (int i = 0; i < (1 << n); i++) {
    cin >> f[i];
    sum += f[i];
  }
  cout << fixed << setprecision(6) << sum / (1 << n) << endl;
  while (r--) {
    int i, c;
    cin >> i >> c;
    sum -= f[i];
    sum += c;
    f[i] = c;
    cout << sum / (1 << n) << endl;
  }
  return 0;
}
