import java.io.*; import java.util.*; import java.util.function.*; import java.util.stream.*; public class Main { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(); int n = sc.nextInt(); int m = sc.nextInt(); if (m == 0) { System.out.println(IntStream.range(0, n).mapToObj(i -> String.valueOf(n - i)).collect(Collectors.joining("\n"))); return; } int[] values = new int[n]; for (int i = 0; i < n; i++) { values[i] = sc.nextInt(); } int[] imos = new int[n + 2]; int[] counts = new int[m]; int current = 0; int right = 0; for (int i = 0; i < n; i++) { while (right < n && current < m) { if (values[right] < m) { counts[values[right]]++; if (counts[values[right]] == 1) { current++; } } right++; } if (current == m) { imos[right - i]++; imos[n - i + 1]--; } if (values[i] < m) { counts[values[i]]--; if (counts[values[i]] == 0) { current--; } } } String result = IntStream.rangeClosed(1, n).mapToObj(i -> { imos[i] += imos[i - 1]; return String.valueOf(imos[i]); }).collect(Collectors.joining("\n")); System.out.println(result); } } class Scanner { BufferedReader br; StringTokenizer st = new StringTokenizer(""); public Scanner() { try { br = new BufferedReader(new InputStreamReader(System.in)); } catch (Exception e) { } } public int nextInt() { return Integer.parseInt(next()); } public long nextLong() { return Long.parseLong(next()); } public double nextDouble() { return Double.parseDouble(next()); } public String next() { try { while (!st.hasMoreTokens()) { st = new StringTokenizer(br.readLine()); } } catch (Exception e) { e.printStackTrace(); } finally { return st.nextToken(); } } }