#K73347. Maximum Distinct Elements in Subarray

    ID: 33955 Type: Default 1000ms 256MiB

Maximum Distinct Elements in Subarray

Maximum Distinct Elements in Subarray

Given an array of integers and a positive integer \(k\), your task is to determine the maximum number of distinct elements in any contiguous subarray of length \(k\). In other words, for every subarray of size \(k\), count the number of distinct elements and output the maximum count observed.

Note that if \(k\) is greater than the length of the array, the answer should be 0.

inputFormat

The first line of input contains two integers \(n\) and \(k\): the number of elements in the array and the length of the subarray, respectively.

The second line contains \(n\) space-separated integers representing the elements of the array.

outputFormat

Print a single integer, which is the maximum number of distinct elements in any subarray of length \(k\>.

## sample
7 4
1 2 1 3 4 2 3
4

</p>