#include <bits/stdc++.h>
using namespace std;
long long n, i, j, k, l, sum = 0, flag = 0, t, a[1000000], ans = 0;
string s;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long double summ = 0.0;
  cin >> n >> ans;
  for (int i = 0; i < (1 << n); i++) {
    cin >> a[i];
    summ += a[i];
  }
  cout << fixed << setprecision(9) << (1.0l * summ / (1LL << n)) << '\n';
  while (ans--) {
    cin >> j >> k;
    summ -= a[j];
    a[j] = k;
    summ += a[j];
    cout << fixed << setprecision(9) << (1.0l * summ / (1LL << n)) << '\n';
  }
  return 0;
}
