#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
template <class T>
using vec = vector<T>;
template <class T>
using v2d = vector<vector<T>>;
template <class T>
using v3d = vector<vector<vector<T>>>;
template <class T>
using v4d = vector<vector<vector<vector<T>>>>;
template <class T>
using prq = priority_queue<T>;
template <class T>
using rpq = priority_queue<T, vector<T>, greater<T>>;
int main() {
  int n, r;
  scanf("%d %d", &n, &r);
  int m = 1 << n;
  vec<int> x(m);
  ll sum = 0;
  for (auto& i : x) {
    scanf("%d", &i);
    sum += i;
  }
  printf("%.9f\n", sum / (double)m);
  while (r--) {
    int u, v;
    scanf("%d %d", &u, &v);
    sum += v - x[u];
    x[u] = v;
    printf("%.9f\n", sum / (double)m);
  }
}
