#include <bits/stdc++.h>
using namespace std;
const int MAXSIZE = 10000020;
int bufpos;
char buf[MAXSIZE];
void init() {
  buf[fread(buf, 1, MAXSIZE, stdin)] = '\0';
  bufpos = 0;
}
int readint() {
  int val = 0;
  for (; !isdigit(buf[bufpos]); bufpos++)
    ;
  for (; isdigit(buf[bufpos]); bufpos++) val = val * 10 + buf[bufpos] - '0';
  return val;
}
char readchar() {
  for (; isspace(buf[bufpos]); bufpos++)
    ;
  return buf[bufpos++];
}
int readstr(char* s) {
  int cur = 0;
  for (; isspace(buf[bufpos]); bufpos++)
    ;
  for (; !isspace(buf[bufpos]); bufpos++) s[cur++] = buf[bufpos];
  s[cur] = '\0';
  return cur;
}
int a[1 << 18];
int main() {
  init();
  int n = 1 << readint(), q = readint();
  long long sum = 0;
  for (int i = 0; i < n; i++) a[i] = readint(), sum += a[i];
  printf("%.8f\n", sum / (double)n);
  while (q--) {
    int p = readint(), v = readint();
    sum += v - a[p];
    a[p] = v;
    printf("%.8f\n", sum / (double)n);
  }
}
