#include <bits/stdc++.h>
using namespace std;
const int N = 105, M = 2005;
vector<int> adj[N];
int st[M], n, m;
bool A[N][N];
bool vis[N][N];
vector<int> euler;
inline void dfs(int v) {
  int u;
  for (int i = 0; i < (int)adj[v].size(); i++) {
    u = adj[v][i];
    if (!vis[v][u]) {
      vis[v][u] = vis[u][v] = 1;
      dfs(u);
    }
  }
  euler.push_back(v);
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= m + 1; i++) scanf("%d", st + i);
  int u, v;
  for (int i = 1; i <= m; i++) {
    u = st[i];
    v = st[i + 1];
    adj[u].push_back(v);
    adj[v].push_back(u);
    A[u][v] = A[v][u] = 1;
  }
  for (int i = 1; i <= n; i++) sort(adj[i].begin(), adj[i].end());
  for (int i = m; i > 1; i--)
    for (int nv = st[i] + 1; nv <= n; nv++)
      if (A[st[i - 1]][nv]) {
        memset(vis, 0, sizeof vis);
        euler.clear();
        for (int j = 1; j < i - 1; j++)
          vis[st[j]][st[j + 1]] = vis[st[j + 1]][st[j]] = 1;
        vis[st[i - 1]][nv] = vis[nv][st[i - 1]] = 1;
        dfs(nv);
        for (int j = i - 1; j > 0; j--) euler.push_back(st[j]);
        reverse(euler.begin(), euler.end());
        if ((int)euler.size() == m + 1 && euler[0] == euler.back()) {
          for (int i = 0; i < (int)euler.size(); i++) printf("%d ", euler[i]);
          return 0;
        }
      }
  printf("No solution\n");
  return 0;
}
