By arrangement!
Easy
Execution time limit is 1 second
Runtime memory usage limit is 64 megabytes
Determine the lexicographic position of a given sequence.
Input
The first line of the input contains two integers, N and K (1 ≤ K ≤ N ≤ 12). The second line provides K distinct integers from the range 1 to N, representing the sequence.
Output
Print a single integer, which is the lexicographic position of the specified sequence.
Examples
Input #1
Answer #1
Submissions 413
Acceptance rate 26%