#include<iostream>
#include<cstdio>
#include<cmath>
#include<ctime>
#include<algorithm>
#include<vector> 
#include<cstring>
#include<string>
#include<map>
#define mp make_pair
#define scn second
#define frs first
#define pb push_back

#define NAME "task"

using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pi;


int a[100000];
int n, k;

int main(){
    freopen(NAME ".in", "r", stdin); 
    freopen(NAME ".out", "w", stdout); 
    scanf("%d%d", &n, &k);
    for (int i = 0; i < n; ++i) 
        scanf("%d", &a[i]);
    sort(a, a + n);
    int ans = 0;
    for (int i = 1; i + k - 1 < n; ++i) {
        if (a[i + k - 1] - a[i] < a[ans + k - 1] - a[ans])
            ans = i;
    }
    for (int i = ans; i < ans + k; ++i)
        printf("%d ", a[i]);
    return 0;
}




