# oj t -c "python3 main.py" import sys,math from collections import defaultdict,deque from itertools import combinations,permutations,accumulate,product from bisect import bisect_left,bisect_right from heapq import heappop,heappush,heapify #from more_itertools import distinct_permutations,distinct_combinations #from sortedcontainers import SortedList,SortedSet def input():return sys.stdin.readline().rstrip() def ii(): return int(input()) def ms(): return map(int, input().split()) def li(): return list(map(int,input().split())) inf = pow(10,18) mod = 998244353 #///////////////////////////////// N,M = ms() A = li() ans = [0]*(N+2) r = 0 tmp = set() cnt = defaultdict(int) for i in range(M): tmp.add(i) for l in range(N): if r0: while r0: cnt[A[r]] += 1 if cnt[A[r]]==1: tmp.discard(A[r]) r += 1 #print(l,r) if len(tmp)==0: ans[r-l] += 1 ans[N-l+1] -= 1 cnt[A[l]] -= 1 if cnt[A[l]]==0 and A[l]