#include <bits/stdc++.h>
using namespace std;
int n, m;
int a[200][200];
int p[3000];
int ans[3000];
int dfs(int u, int dep, int ok) {
  int v;
  ans[dep] = u;
  if (dep == m) return ok;
  if (ok)
    v = 1;
  else
    v = p[dep + 1];
  for (int i = v; i <= n; i++) {
    if (a[u][i] && a[i][u]) {
      a[i][u] = a[u][i] = 0;
      if (i != p[dep + 1]) {
        if (dfs(i, dep + 1, 1)) return 1;
      } else if (dfs(i, dep + 1, ok))
        return 1;
      a[i][u] = a[u][i] = 1;
    }
  }
  return 0;
}
int main() {
  cin >> n >> m;
  for (int i = 0; i <= m; i++) {
    cin >> p[i];
    if (i) a[p[i]][p[i - 1]] = a[p[i - 1]][p[i]] = 1;
  }
  if (dfs(p[0], 0, 0)) {
    for (int i = 0; i <= m; i++) {
      cout << ans[i] << " ";
    }
    cout << endl;
  } else {
    cout << "No solution" << endl;
  }
  return 0;
}
