#include <bits/stdc++.h>
using namespace std;
void Draganov47() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}
void print(long long a, long long b) {
  long double sum = a;
  long double k = b;
  cout << setprecision(10) << fixed << sum / k << '\n';
}
int main() {
  Draganov47();
  int n, r;
  cin >> n >> r;
  vector<long long> a(1 << n);
  long long sum = 0;
  for (int i = 0; i < (1 << n); i++) {
    cin >> a[i];
    sum += a[i];
  }
  print(sum, (1 << n));
  for (int i = 0; i < r; i++) {
    int pos, val;
    cin >> pos >> val;
    sum -= a[pos];
    a[pos] = val;
    sum += val;
    print(sum, (1 << n));
  }
  return 0;
}
