By arrangement!#1794

By arrangement!

1 second
64 megabytes
Easy

Determine the lexicographic position of the given arrangement.

Input

The first line contains two integers and (1 \leq K \leq N \leq 12). The second line contains distinct integers from to – the arrangement.

Output

Print a single integer: the lexicographic position number of the given arrangement.

Examples

Example 1

Loading
Loading