#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  int n, r;
  cin >> n >> r;
  int k = 1 << n;
  vector<long long> b(k);
  long long sum = 0;
  for (int i = 0; i < k; ++i) {
    cin >> b[i];
    sum += b[i];
  }
  cout << fixed << setprecision(9);
  cout << (double)sum / k << '\n';
  for (int i = 0; i < r; ++i) {
    int a, x;
    cin >> a >> x;
    sum -= b[a];
    b[a] = x;
    sum += b[a];
    cout << (double)sum / k << '\n';
  }
}
