#include <cstdio>
#include <algorithm>
#include <map>

using namespace std;

typedef pair< int, int > par;
typedef pair< par, int > tri;

const int MaxN = 1001;

tri a[ MaxN ];
map< int, par > M;

int main( void ) {
  int n, w;
  scanf( "%d %d", &n, &w );
  for( int i = 0; i < n; ++i ) {
    int x;
    scanf( "%d", &x );
    if( M.count( x ) ) M[x].first--; else
      M[x] = par( 10000, i );
  }

  int c = 0;
  for( map< int, par > :: iterator it = M.begin(); it != M.end(); ++it )
    a[c++] = tri( it->second, it->first );

  sort( a, a+c );
  int ok = 0;
  for( int i = 0; i < c; ++i ) {
    int x = 10001-a[i].first.first;
    for( int j = 0; j < x; ++j ) {
      if( ok ) putchar( ' ' );
      printf( "%d", a[i].second );
      ok = 1;
    }
  }
  putchar( '\n' );
  return 0;
}
