#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  long long n, r;
  cin >> n >> r;
  n = 1 << n;
  long long c[n], sum = 0;
  for (long long i = 0; i < n; i++) {
    cin >> c[i];
    sum += c[i];
  }
  cout << fixed << setprecision(10) << endl;
  cout << (double)sum / n << endl;
  for (long long i = 0; i < r; i++) {
    long long idx, val;
    cin >> idx >> val;
    sum -= c[idx];
    c[idx] = val;
    sum += c[idx];
    cout << (double)sum / n << endl;
  }
  return 0;
}
