#include <bits/stdc++.h>
using namespace std;
const long long maxn = 1e6 + 00;
const long long inf = 1e9 + 800;
long long a[maxn];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long n, r, sum = 0;
  ;
  cin >> n >> r;
  for (long long i = 0; i < (1 << n); i++) {
    cin >> a[i];
    sum += a[i];
  }
  cout << fixed << setprecision(10);
  for (long long i = 0; i < r; i++) {
    cout << (long double)sum / (1 << n) << endl;
    long long p, v;
    cin >> p >> v;
    sum -= a[p];
    a[p] = v;
    sum += a[p];
  }
  cout << (long double)sum / (1 << n) << endl;
}
