#include <bits/stdc++.h>
using namespace std;
inline long long read() {
  char ch = getchar();
  long long nega = 1;
  while (!isdigit(ch)) {
    if (ch == '-') nega = -1;
    ch = getchar();
  }
  long long ans = 0;
  while (isdigit(ch)) {
    ans = ans * 10 + ch - 48;
    ch = getchar();
  }
  if (nega == -1) return -ans;
  return ans;
}
void print(vector<long long> x) {
  for (long long i = 0; i < (long long)x.size(); i++)
    printf("%d%c", x[i], " \n"[i == (long long)x.size() - 1]);
}
long long a[300005], n, Q, sum;
void print() { printf("%.6lf\n", (double)sum / (1 << n)); }
signed main() {
  cin >> n >> Q;
  for (long long i = 0; i < 1 << n; i++) a[i] = read(), sum += a[i];
  print();
  while (Q--) {
    long long pos = read(), v = read();
    sum -= a[pos];
    a[pos] = v;
    sum += a[pos];
    print();
  }
  return 0;
}
