#include <bits/stdc++.h>
using namespace std;
inline long long Max(long long a, long long b) { return a > b ? a : b; }
inline long long Min(long long a, long long b) { return a < b ? a : b; }
inline long long read() {
  long long x = 0;
  int ch = getchar(), f = 1;
  while (!isdigit(ch) && (ch != '-') && (ch != EOF)) ch = getchar();
  if (ch == '-') f = -1, ch = getchar();
  while (isdigit(ch)) x = (x << 1) + (x << 3) + ch - '0', ch = getchar();
  return x * f;
}
inline void write(long long x) {
  if (x < 0) putchar('-'), x = -x;
  if (x >= 10)
    write(x / 10), putchar(x % 10 + '0');
  else
    putchar(x + '0');
}
void scan(int &x) {
  bool neg = false;
  register int c;
  x = 0;
  c = getchar();
  if (c == '-') {
    neg = true;
    c = getchar();
  }
  for (; (c > 47 && c < 58); c = getchar()) x = (x << 1) + (x << 3) + c - 48;
  if (neg) x *= -1;
}
int val[(int)(1e6 + 1)];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cout << fixed << setprecision(20);
  int n, r;
  cin >> n >> r;
  unsigned long long sum = 0;
  long long div = 1 << n;
  for (int i = 0; i < div; i++) {
    cin >> val[i];
    sum += val[i];
  }
  for (int i = 0; i <= r; i++) {
    cout << ((sum + .0) / (div + .0)) << "\n";
    if (i != r) {
      int dele;
      int neww;
      cin >> dele >> neww;
      sum -= (val[dele] - neww);
      val[dele] = neww;
    }
  }
}
