#include <bits/stdc++.h>
using namespace std;
const int mm = 110;
int g[mm][mm], chu[2100], ans[2100], n, m;
bool dfs(int u, int depth, bool ok) {
  ans[depth] = u;
  if (depth == m) return ok;
  int beg = chu[depth + 1];
  bool flag;
  if (ok) beg = 1;
  for (int i = beg; i <= n; ++i)
    if (g[u][i]) {
      g[u][i] = g[i][u] = 0;
      if (i ^ chu[depth + 1])
        flag = dfs(i, depth + 1, 1);
      else
        flag = dfs(i, depth + 1, ok);
      if (flag) return 1;
      g[u][i] = g[i][u] = 1;
    }
  return 0;
}
int main() {
  while (~scanf("%d%d", &n, &m)) {
    memset(g, 0, sizeof(g));
    for (int i = 0; i <= m; ++i) {
      scanf("%d", &chu[i]);
      if (i) g[chu[i]][chu[i - 1]] = g[chu[i - 1]][chu[i]] = 1;
    }
    if (dfs(chu[0], 0, 0)) {
      for (int i = 0; i <= m; ++i) printf("%d ", ans[i]);
      puts("");
    } else
      printf("No solution\n");
  }
}
