#include <bits/stdc++.h>
using namespace std;
using LL = long long;
using LD = long double;
const int MX = 1 << 18 | 3;
struct Istream {
  static const int MXL = 2000000;
  char bf[MXL], *p1, *p2;
  FILE* F;
  Istream(FILE* F = stdin) : p1(bf), p2(bf), F(F) {}
  char getchar() {
    return p1 == p2 && (p2 = (p1 = bf) + fread(bf, 1, MXL, F)) == bf ? EOF
                                                                     : *p1++;
  }
  Istream& operator>>(int& x) {
    int c = 0;
    x = 0;
    while (!isdigit(c)) c = getchar();
    while (isdigit(c)) x = x * 10 + c - '0', c = getchar();
    return *this;
  }
} __JUMPMELON_DA_ZUI_ZI__;
int N, a[MX], Q;
LL sum;
int main() {
  ios::sync_with_stdio(0);
  cout << fixed << setprecision(10);
  __JUMPMELON_DA_ZUI_ZI__ >> N >> Q;
  for (int i = 0; i < (1 << N); i++)
    __JUMPMELON_DA_ZUI_ZI__ >> a[i], sum += a[i];
  cout << (LD)sum / (1 << N) << "\n";
  while (Q--) {
    int u, x;
    __JUMPMELON_DA_ZUI_ZI__ >> u >> x;
    sum = sum - a[u] + x;
    a[u] = x;
    cout << (LD)sum / (1 << N) << "\n";
  }
  return 0;
}
