
import java.io.BufferedReader

class Node(val id: Int) {
    private val links: MutableSet<Node> = mutableSetOf()
    override fun equals(other: Any?): Boolean {
        other.let {
            if (it is Node && this.id == it.id) {
                return true
            }
        }
        return super.equals(other)
    }

    fun addLink(n: Node) {
        this.links.add(n)
    }

    fun getLinks(): Set<Int> {
        return this.links.map(Node::id).toSet()
    }
}

fun main(args: Array<String>) {
    /** comment in when you submit **/
    System.`in`.bufferedReader().use { println(getOutputString(it)) }

    /** delete below after your test **/
    //executeTest()
}

private fun getOutputString(reader: BufferedReader): String {
    val (n, m) = reader.readLine().let {
        val d = it.split(" ")
        Pair(d[0].toInt(), d[1].toInt())
    }
    val nodes = (1..n).map {
        Pair(it, Node(it))
    }.toMap()
    reader.readLines().forEach {
        val d = it.split(" ")
        Pair(d[0].toInt(), d[1].toInt())
        nodes[d[0].toInt()]?.let { base ->
            nodes[d[1].toInt()]?.let { dest ->
                base.addLink(dest)
                dest.addLink(base)
            }
        }
    }
    return culc(1, nodes, nodes.keys.toMutableList()).toString()
}

private fun culc(current: Int, nodes: Map<Int, Node>, cands: MutableList<Int>): Int {
    return nodes[current]?.let {
        if (cands.count() == 1 && cands[0] == current) {
            return 1
        }

        cands.remove(current)

        it.getLinks().filter { l -> l in cands }
                .map { culc(it, nodes, cands.map { it }.toMutableList()) }.sum()
    } ?: 0
}

/** delete below after your test **/
private fun String.mustBe(expected: String): Unit {
    if (this != expected) throw Exception("\"$this\" must be \"$expected\"")

    println("ok")
}

private fun executeTest() {
    getOutputString("3 3\n1 2\n1 3\n2 3".toByteArray(Charsets.UTF_8).inputStream().bufferedReader()).mustBe("2")
    getOutputString("7 7\n1 3\n2 7\n3 4\n4 5\n4 6\n5 6\n6 7".toByteArray(Charsets.UTF_8).inputStream().bufferedReader()).mustBe("1")
}
