#include <bits/stdc++.h>
using namespace std;
vector<int> a[105];
int s[2005];
int u[105][105];
int edg[105][105];
vector<int> ans;
vector<int> p;
vector<int> base;
void go(int x) {
  for (int i = 0; i < (int)a[x].size(); i++)
    if (u[x][a[x][i]] == 0) {
      u[x][a[x][i]] = u[a[x][i]][x] = 2;
      go(a[x][i]);
      p.push_back(x);
    }
}
int main(void) {
  int n, m;
  scanf("%d%d", &n, &m);
  for (int i = 0; i <= m; i++) scanf("%d", &s[i]);
  for (int i = 0; i < m; i++) {
    a[s[i]].push_back(s[i + 1]);
    a[s[i + 1]].push_back(s[i]);
    edg[s[i]][s[i + 1]] = edg[s[i + 1]][s[i]] = 1;
  }
  for (int i = 1; i <= n; i++) sort(a[i].begin(), a[i].end());
  for (int i = 0; i < m; i++) u[s[i]][s[i + 1]] = u[s[i + 1]][s[i]] = 1;
  for (int i = 0; i <= m; i++) base.push_back(s[i]);
  ans.push_back(10000);
  for (int i = m - 1; i >= 0; --i) {
    u[s[i]][s[i + 1]] = u[s[i + 1]][s[i]] = 0;
    for (int x = s[i + 1] + 1; x <= n; x++) {
      if (edg[s[i]][x] && u[s[i]][x] != 1) {
        u[s[i]][x] = u[x][s[i]] = 1;
        p.clear();
        p.push_back(s[0]);
        go(x);
        for (int j = i; j >= 0; --j) p.push_back(s[j]);
        if (p.size() == m + 1) {
          reverse(p.begin(), p.end());
          if (p < ans) ans = p;
        }
        u[s[i]][x] = u[x][s[i]] = 0;
        for (int j = i; j < m; j++) u[s[j]][s[j + 1]] = u[s[j + 1]][s[j]] = 0;
        if (p.size() == m + 1) break;
      }
    }
  }
  if (ans[0] == 10000)
    printf("No solution\n");
  else {
    for (int j = 0; j <= m; j++) printf("%d ", ans[j]);
    puts("");
  }
  return 0;
}
