package main
import (
"io"
"os"
"strconv"
)
func main() {
data, _ := io.ReadAll(os.Stdin)
idx := 0
nextInt := func() int64 {
for idx < len(data) && (data[idx] < '0' || data[idx] > '9') {
idx++
}
var v int64
for idx < len(data) && data[idx] >= '0' && data[idx] <= '9' {
v = v*10 + int64(data[idx]-'0')
idx++
}
return v
}
n := int(nextInt())
r := int(nextInt())
m := 1 << n
a := make([]int64, m)
var sum int64
for i := 0; i < m; i++ {
a[i] = nextInt()
sum += a[i]
}
den := float64(m)
out := make([]byte, 0, (r+1)*16)
out = strconv.AppendFloat(out, float64(sum)/den, 'f', 10, 64)
out = append(out, '\n')
for i := 0; i < r; i++ {
z := int(nextInt())
g := nextInt()
sum += g - a[z]
a[z] = g
out = strconv.AppendFloat(out, float64(sum)/den, 'f', 10, 64)
out = append(out, '\n')
}
os.Stdout.Write(out)
}