#include <bits/stdc++.h>

using namespace std;

int main()
{
    long n,k,s;
    s=0;
    scanf("%ld%ld",&n,&k);
    long a[n];
    long c[2*n];
    long b[2*n]=(long*)calloc(2*n,sizeof(2*n));
    for (long i=0;i<n;i++)
    {
        scanf("%ld",&a[i]);
        b[a[i]]=b[a[i]]+1;
    }
    for (long i=-n;i<n;i++)
        if (b[i]>=k)
    {
        c[s]=b[i];
        s=s+1;
    }
    printf("%ld",s);
    for (int i=0;i<s;i++)
        printf("%ld",c[i]);
        
        
    return 0;
}