#include<bits/stdc++.h>

using namespace std;

int main()
{
    int n, k;
    cin >> n >> k;
    int a[n];
    for(int i = 0;i < n;i++)
        cin >> a[i];

    int pr = 2*n+1;
    int b[pr], c[pr];
    for(int i = 0;i < pr;i++){
        if(b[i] <= n)
        b[i] =-n+i;
    b[i] = n-i;
    c[i] = 0;}

    for(int i = 0;i < n;i++)
        for(int j = 0;j < pr;j++)
        if(a[i]== b[j])
        c[j]++;

    int br = 0;
    int res[n/k];

    for(int j = 0;j < pr;j++){
        if(c[j] >= k){
        res[br] = b[j];
        br++;}}
if(br == 0)
    cout << 0;
else{
    cout << br << endl;
    for(int i = 0;i < br;i++)
        cout <<res[i] << " ";}
    return 0;
}