#include <bits/stdc++.h>
using namespace std;
double a[2000005], sum = 0;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cout << setprecision(12);
  long long n, r, i, j, idx, x, tot;
  cin >> n >> r;
  tot = (1 << n);
  for (i = 0; i < (1 << n); i++) {
    cin >> a[i];
    sum += a[i];
  }
  cout << (sum / (1.0l * tot)) << "\n";
  while (r--) {
    cin >> idx >> x;
    sum += (x - a[idx]);
    a[idx] = x;
    cout << (sum / (1.0l * tot)) << "\n";
  }
  return 0;
}
