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 1 to k).
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.
The first line contains an integer t (1≤t≤100), the number of test cases.
Each test case consists of two lines. The first line contains two integers n and k (1≤k≤n≤200), where n is the number of parties and k is the number of distinct costume types (costumes are numbered from 1 to k). The second line contains n integers, the costume required at each successive party.
For each test case, print a single line with one integer: the minimum number of times Bajtazar must put on a costume.