题目描述
Problem Description
Hanako is playing with $ n $ cards ($4 \leq n \leq 10$). Each card has an integer between $ 1 $ and $ 99 $ written on it. Hanako decided to choose $ k $ cards ($2 \leq k \leq 4$) from these cards and arrange them in a row to form an integer. How many different integers can Hanako form?
For example, given $ 5 $ cards with the numbers $ 1, 2, 3, 13, 21 $, and choosing $ 3 $ cards to form an integer, arranging $ 2, 1, 13 $ in this order gives the integer $ 2113 $. Also, arranging $ 21, 1, 3 $ in this order also gives the same integer $ 2113 $. As shown, the same integer can be formed from different combinations of cards.
Given $ n $ cards with their integers, write a program to find the number of different integers that can be formed by choosing $ k $ cards and arranging them in a row.
Input Format
The input consists of $ 2 + n $ lines. The first line contains the number of cards $ n $ ($4 \leq n \leq 10$), and the second line contains the number of cards to choose $ k $ ($2 \leq k \leq 4$). The $ 2 + i $ line ($1 \leq i \leq n$) contains the integer written on the $ i $th card, which is between $ 1 $ and $ 99 $.
Output Format
The output consists of one line containing the number of different integers that Hanako can form.
Sample Input and Output
Sample Input #1
4
2
1
2
12
1
Sample Output #1
7
Sample Input #2
6
3
72
2
12
7
2
1
Sample Output #2
68
Notes/Hints
Sample Explanation 1
In the first sample input, from the $ 4 $ cards with numbers $ 1, 2, 12, 1 $, choosing $ 2 $ cards and arranging them in a row can form the integers $ 11, 12, 21, 112, 121, 122, 212 $, which are $ 7 $ in total.
输入格式
见题面 Input 部分
输出格式
见题面 Output 部分