Exchange

No attempts yetTime limit1sMemory limit256 MB

Problem

You are given an array AA of length NN and an integer MM. Jihak wrote the program below.

for i <- 1 to M do
    for j <- i+1 to N do
        if A[i] > A[j] then
            swap(A[i], A[j])

The array is 1-indexed, and swap(A[i], A[j]) exchanges the values of the two elements. Count how many times swap is called before the program ends.

Input

The input holds several test cases. The first line of each test case has two natural numbers NN and MM. (1N,M999991 \le N, M \le 99999)

The second line has the elements A[1],A[2],,A[N]A[1], A[2], \dots, A[N] of the array AA, separated by spaces. (109A[i]109-10^9 \le A[i] \le 10^9)

The input runs to the end of the file and holds at most 20 test cases.

Output

For each test case, print the number of swap calls on one line.