#include <stdio.h>

int main()
{
    int n,k,m=0;
    long c=0,min=1;
    scanf("%d%d",&n,&k);
    int i,a[n],j,b[n-1];
    for (i=1;i<=n;i++) scanf("%d",&a[i]);
    for (i=1;i<=n;i++)
    {
        for (j=1;j<=n;j++)
            if (i!=j) c=c*10+a[j];
        if (min==1) min=c;
        if (min>c) min=c;
        c=0;
    }
    while (min>0)
    {
        m++;
        b[m]=min%10;
        min=min/10;
    }
    for (i=m;i>=1;i--) printf("%d ",b[i]);
    return 0;
}