Halloween

No attempts yetTime limit1sMemory limit128 MB

Problem

Halloween is coming. Bajtazar, a university student, wants to attend several costume parties. At each party he must show up wearing one specific costume (costume types are numbered from 11 to kk).

Bajtazar can wear many costumes at once, layered on top of one another like a stack: a new costume is always put on over the outermost costume he is currently wearing, and he can only take off the outermost (topmost) costume.

Before each party he may take off any number of costumes from the top and put on any number of new costumes on top, as long as after these operations his outermost costume is exactly the one required at that party. (He owns an unlimited number of copies of every costume, so he can always put on a fresh copy of any costume.)

Getting dressed is tiring, so Bajtazar wants to minimize the total number of times he puts on a costume across all parties; taking costumes off is free. Given the costume required at each party in order, find the minimum number of put-on actions.

Input

The first line contains an integer tt (1t1001 \le t \le 100), the number of test cases.

Each test case consists of two lines. The first line contains two integers nn and kk (1kn2001 \le k \le n \le 200), where nn is the number of parties and kk is the number of distinct costume types (costumes are numbered from 11 to kk). The second line contains nn integers, the costume required at each successive party.

Output

For each test case, print a single line with one integer: the minimum number of times Bajtazar must put on a costume.