
Imports System.Console
Module Module1
    Dim n, k As Integer
    Dim ans As Int64 = 1
    Dim max() As Integer
    Sub Main()
        Dim s() As String = ReadLine.Split
        n = s(0)
        k = s(1)
        ReDim max(k - 1)
        Dim s1() As String = ReadLine.Split
        Dim intt(n) As Integer
        For i = 1 To n
            intt(i) = s1(i)
        Next
        For i = 1 To n
            Plusmax(intt(i))
        Next
        For i = 0 To k - 1
            ans = ans * max(i) Mod (10 ^ 9 + 7)
        Next
        WriteLine(ans)
    End Sub
    Public Sub Plusmax(n As Integer)
        For i = 0 To k - 1
            If max(i + 1) <= n Then
                max(i) = max(i + 1)
            Else
                max(i) = n
            End If
        Next
    End Sub
End Module
