#include <bits/stdc++.h>
using namespace std;
void print(long long sum, int n) {
  double ans = double(sum) / double(1 << n);
  cout << ans << "\n";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n, q;
  cin >> n >> q;
  cout << fixed;
  cout.precision(20);
  vector<long long> a(1 << n);
  long long sum = 0;
  for (int i = 0; i < (1 << n); ++i) {
    cin >> a[i];
    sum += a[i];
  }
  print(sum, n);
  while (q--) {
    int pos;
    cin >> pos;
    long long x;
    cin >> x;
    sum -= a[pos];
    a[pos] = x;
    sum += x;
    print(sum, n);
  }
}
