#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  std::cout << std::fixed;
  std::cout << std::setprecision(6);
  int n, r;
  cin >> n >> r;
  int x = pow(2, n);
  int f[x];
  double sum = 0;
  for (int i = 0; i < x; i++) {
    cin >> f[i];
    sum += f[i];
  }
  cout << sum / x << endl;
  for (int i = 0; i < r; i++) {
    int a, b;
    cin >> a >> b;
    sum += b - f[a];
    f[a] = b;
    cout << sum / x << endl;
  }
}
