You are provided K different tasks and you have to perform a single activity on a single day. The activities are numbered by using the integers 1, 2, ...K.
A time table has been provided to you that must be followed for the next N days. The time table states that on the ith day, you should do the job with index A[i]. 1≤A[i]≤K
A rule states that if you do some particular job with index X on a day with index Y, then you should not do the same job any time before day Y+K. You cannot perform the job with index X on any day in the range [Y+1,Y+K−1] in such a case.
You are required to change the time table in such a way that it also satisfies the mentioned rule. You also have to make the minimum number of changes in the time table. A change involves modifying a job that has to be done on some day i (1≤i≤N) to any other job in the range of 1...K. Your task is to determine this minimum number.
Input format
Output format
For each test case, print a single integer on a single line.
Constraints
1≤T≤31≤N≤100,0002≤K≤1001≤A[i]≤K
We can change the job to be done on the 3rd day from 2 to 1. This ensures we follow the rule mentioned in the statement, and also make the minimum number of changes.