import java.io.{BufferedReader, InputStreamReader}

import scala.collection.mutable

object Main {
  def main(args: Array[String]): Unit = {
    val in = new BufferedReader(new InputStreamReader(System.in))
    val Array(n, k) = in.readLine().split("\\s+").map(_.toInt)
    val as = in.readLine().split("\\s+").map(_.toLong).sorted

    def stream(baseIndex: Int): Stream[Long] = {
      def inner(curIndex: Int): Stream[Long] = {
        if (baseIndex <= curIndex) {
          Stream.empty
        } else {
          Stream.cons(as(baseIndex) * as(curIndex), inner(curIndex + 1))
        }
      }

      inner(0)
    }

    var streams = (1 until n).map(stream).toArray
    var current = 0L;

    for {
      i <- 0 until k
    } {
      streams = streams.filter(_.nonEmpty).sortBy(_.head)
      current = streams.head.head
      streams(0) = streams(0).tail
    }

    System.out.println(current)
  }
}
