/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ import java.math.*; import java.util.Scanner; /** * * @author Iridescent */ public class Main { public static final int MAXN = 110; public static int[] a = new int[MAXN]; public static BigInteger dp[][] = new BigInteger[MAXN][MAXN]; public static void main(String[] args) { // TODO code application logic here Scanner cin = new Scanner(System.in); while(cin.hasNext()) { int n = cin.nextInt(); int m = cin.nextInt(); for(int i = 0 ; i < MAXN ; i++) for(int j = 0 ; j < MAXN ; j++) dp[i][j] = BigInteger.ZERO; for(int i = 1 ; i <= n ; i++) a[i] = cin.nextInt(); for(int i = 1 ; i <= n ; i++) { dp[i][1] = dp[i][1].add(BigInteger.ONE); for(int j = i + 1 ; j <= n ; j++) { if(a[j] > a[i]) for(int k = 1 ; k <= n ; k++) { dp[j][k] = dp[j][k].add(dp[i][k - 1]); } } } BigInteger ans = new BigInteger("0"); for(int i = 1 ; i <= n ; i++) ans = ans.add(dp[i][m]); System.out.println(ans); } } }