fun main(args: Array<String>) {
    val (H, W) = readInputLine().split(" ").map { it.toInt() }
    readInputLine()
    val aList = readInputLine().split(" ").map { it.toInt() }
    
    val ans = Array(H, { IntArray(W) } )
    var nowH = 0
    var nowW = 0
    
    for ((index, a) in aList.withIndex()) {
        for (j in 1..a) {
            ans[nowH][nowW] = index + 1
            if (nowH % 2 == 0) {
                nowW++
                if (nowW >= W) {
                    nowW--
                    nowH++
                }
            } else {
                nowW--
                if (nowW < 0) {
                    nowW++
                    nowH++
                }
            }
        }
    }
    
    for (a in ans) {
        println(a.joinToString(" "))
    }
}

fun readInputLine(): String {
    return readLine()!!
}
