#include <bits/stdc++.h>
using namespace std;
string to_string(string s) { return '"' + s + '"'; }
string to_string(const char* s) { return to_string((string)s); }
string to_string(bool s) { return to_string((int)s); }
template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto& x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
const long double eps = 1e-12;
const int N = 3e5 + 9;
const int M = 1000000;
pair<int, pair<int, int>> a[N];
vector<int> g[N];
int from[N], ans[N], n,
    s[][3] = {{1, 1, 1},    {1, 1, -1},  {1, -1, 1},  {-1, 1, 1},
              {-1, -1, -1}, {-1, -1, 1}, {-1, 1, -1}, {1, -1, -1}};
void dfs(int u, int sgn = 1) {
  if (u < n) ans[u] = sgn;
  for (int v : g[u]) {
    dfs(v, sgn * from[v]);
  }
}
int c[(1 << 19) + 9];
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int u, f, n, r;
  cin >> n >> r;
  long long sum = 0;
  for (int i = 0; i < (1 << n); i++) {
    cin >> c[i];
    sum += c[i];
  }
  cout << fixed << setprecision(20);
  cout << 1.l * sum / (1 << n) << endl;
  for (int i = 0; i < r; i++) {
    cin >> u >> f;
    sum = sum - c[u] + f;
    c[u] = f;
    cout << 1.l * sum / (1 << n) << endl;
  }
  return 0;
}
