#include <bits/stdc++.h>
using namespace std;
bool g[110][110];
int tar[2010], ans[2010];
int n, m;
bool dfs(int u, int cur, bool flag) {
  ans[cur] = u;
  if (cur == m && flag) return true;
  for (int v = flag ? 1 : tar[cur + 1]; v <= n; v++) {
    if (g[u][v]) {
      g[u][v] = g[v][u] = false;
      if (v != tar[cur + 1]) {
        if (dfs(v, cur + 1, true)) return true;
      } else {
        if (dfs(v, cur + 1, flag)) return true;
      }
      g[u][v] = g[v][u] = true;
    }
  }
  return false;
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 0; i <= m; i++) scanf("%d", tar + i);
  for (int i = 1; i <= m; i++)
    g[tar[i - 1]][tar[i]] = g[tar[i]][tar[i - 1]] = true;
  if (dfs(tar[0], 0, false)) {
    for (int i = 0; i <= m; i++) printf("%d ", ans[i]);
    puts("");
  } else {
    puts("No solution");
  }
  return 0;
}
