#include <bits/stdc++.h>
using namespace std;
inline long long read() {
  long long ans = 0, w = 1;
  char ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') w = -1;
    ch = getchar();
  }
  while (isdigit(ch)) {
    ans = (ans << 3) + (ans << 1) + ch - '0';
    ch = getchar();
  }
  return ans * w;
}
long long n, sum = 0, r, a[(1 << 18) + 5];
int main() {
  n = read(), r = read();
  n = (1 << n);
  for (int i = 1; i <= n; ++i) a[i] = read(), sum += a[i];
  printf("%6lf", (double)sum / n);
  while (r--) {
    long long p = read() + 1, v = read();
    sum = sum - a[p] + v;
    a[p] = v;
    printf("\n%6lf", (double)sum / n);
  }
  return 0;
}
