#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fll;
const long double pi = acos(-1);
const int MOD = 1e9 + 7;
const int N = 1e6;
int n, r;
int v[N];
int main() {
  scanf("%d %d", &n, &r);
  for (int i = 0; i < (1 << n); i++) scanf("%d", &v[i]);
  long long sum = 0;
  for (int i = 0; i < (1 << n); i++) sum += v[i];
  cout << fixed << setprecision(10);
  double lim = (1 << n);
  cout << sum / lim << endl;
  for (int i = 0; i < r; i++) {
    int a, b;
    scanf("%d %d", &a, &b);
    sum -= v[a];
    v[a] = b;
    sum += v[a];
    cout << sum / lim << endl;
  }
  return 0;
}
