MDCPP 最多色彩帶
給水壺好好ㄘ和jameslee
x,y=map(int,input().split())
l=list(map(int,input().split()))
# x,y=10,5
# l=[4,3,4,3,2,3,1,3,1,3]
t=dict()
count=0
tmp=0
for i in range(x):
x=t.get(l[i],0)
if x==0:
t[l[i]]=1
else:
t[l[i]]+=1
if i>y-1:
t[l[i-y]]-=1
if t[l[i-y]]==0:
t.pop(l[i-y])
# print(i,l[i])
# print(len(t),t)
tmp=len(t)
if count<tmp:
count=tmp
if count==y:
break
print(count)