#include using namespace std; int main() { int n; scanf("%d", &n); int lines; scanf("%d", &lines); int answer[lines + 1]; int current = lines; int temp; for (int i = 1; i < n; i++) { scanf("%d", &temp); if (temp != current) { for (int j = current; j > temp; j--) { answer[j] = i; } current = temp; } } for (int i = 1; i <= current; i++) { printf("%d ", n); } for (int i = current + 1; i <= lines; i++) { printf("%d ", answer[i]); } return 0; }