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