#include <bits/stdc++.h>
using namespace std;
const int N = 1 << 19;
int n, r;
double sum;
int a[N];
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout << fixed << setprecision(15);
  cin >> n >> r;
  for (int i = 0; i < 1 << n; ++i) {
    cin >> a[i];
    sum += a[i];
  }
  cout << sum / (1 << n) << '\n';
  while (r--) {
    int ind, v;
    cin >> ind >> v;
    sum -= a[ind];
    a[ind] = v;
    sum += a[ind];
    cout << sum / (1 << n) << '\n';
  }
}
