#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
const int N = 1 << 18;
long long c[N];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n, r;
  cin >> n >> r;
  long long sum = 0;
  for (int i = 0; i < (1 << n); i++) {
    cin >> c[i];
    sum += c[i];
  }
  cout << fixed << setprecision(7) << (double)sum / (1 << n) << '\n';
  for (int i = 0; i < r; i++) {
    int z, g;
    cin >> z >> g;
    sum += g - c[z];
    c[z] = g;
    cout << fixed << setprecision(7) << (double)sum / (1 << n) << '\n';
  }
  return 0;
}
