#include <bits/stdc++.h>
using namespace std;
const int MAXN = 110;
const int MAXM = 2200;
bool mat[MAXN][MAXN], found = false;
int path[MAXM], ans[MAXM];
int n, m;
int Dfs(int pos, bool big, int cnt) {
  ans[cnt] = pos;
  if (cnt == m && big) {
    found = true;
    return 0;
  }
  for (int i = big ? 1 : path[cnt + 1]; i <= n && !found; i++) {
    if (mat[pos][i]) {
      mat[pos][i] = mat[i][pos] = false;
      Dfs(i, big || i > path[cnt + 1], cnt + 1);
      mat[pos][i] = mat[i][pos] = true;
    }
  }
  return 0;
}
int main() {
  scanf("%d %d", &n, &m);
  memset(mat, false, sizeof(mat));
  for (int i = 0, a, b; i <= m; i++) {
    scanf("%d", &b);
    path[i] = b;
    if (i > 0) {
      mat[a][b] = mat[b][a] = true;
    }
    a = b;
  }
  Dfs(path[0], false, 0);
  if (!found)
    puts("No solution");
  else {
    for (int i = 0; i <= m; i++) printf("%d%c", ans[i], i == m ? 10 : 32);
  }
  return 0;
}
