#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
vector<int> edge[105];
const int maxn = 300500;
int main() {
  int n, r;
  double pown = 1;
  cout.precision(6);
  int a[maxn];
  double ans = 0;
  long long sum = 0;
  cin >> n >> r;
  for (int i = 0; i < n; i++) pown *= 2;
  for (int i = 0; i < pown; i++) {
    cin >> a[i];
    sum += a[i];
  }
  ans = sum * 1.0 / pown;
  cout << fixed << ans << endl;
  for (int i = 0; i < r; i++) {
    int x, num;
    cin >> x >> num;
    sum += (num - a[x]);
    a[x] = num;
    ans = sum * 1.0 / pown;
    cout << fixed << ans << endl;
  }
}
