나의정답.
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
using namespace std;
int main(int argc, char** argv) {
//freopen("input.txt", "rt", stdin);
int s, n, tmp;
bool cash_miss;
scanf("%d %d", &s, &n);
vector<int> num(n);
vector<int> size(s);
for(int i = 0 ; i < n; i++)
scanf("%d", &num[i]);
for(int i = 0 ; i < s ; i++)
size[i] = num[i];
for(int i = s; i < n; i++){
tmp = num[i];
cash_miss = true;
for(int j = 0; j < s; j++){
if(size[j] == tmp){
for(int k = j; k > 0; k--){
size[k] = size[k-1];
}
size[0] = tmp;
cash_miss = false;
break;
}
}
if(cash_miss == true){
for(int j = s; j > 0; j--){
size[j] = size[j-1];
}
size[0] = tmp;
}
}
for(int i = 0 ; i < s; i++)
printf("%d ", size[i]);
}