#include <bits/stdc++.h>
using namespace std;
const int maxn = 105;
bool g[maxn][maxn];
int n, m, sc;
vector<int> ans;
int tlen, cnt;
bool vis[maxn];
void dfs(int v) {
  if (vis[v]) return;
  vis[v] = true;
  for (int i = 1; i <= n; i++) {
    if (g[v][i]) {
      cnt++;
      dfs(i);
    }
  }
}
int getN() {
  memset(vis, false, sizeof(vis));
  cnt = 0;
  dfs(sc);
  assert(cnt % 2 == 0);
  return cnt / 2;
}
void getAns() {
  while (tlen != 0) {
    int x = ans.back();
    for (int i = 1; i <= n; i++) {
      if (g[x][i]) {
        g[x][i] = g[i][x] = false;
        tlen--;
        if (getN() == tlen) {
          ans.push_back(i);
          break;
        }
        g[x][i] = g[i][x] = true;
        tlen++;
      }
      if (i == n) assert(0);
    }
  }
}
int main() {
  while (scanf("%d%d", &n, &m) != EOF) {
    memset(g, false, sizeof(g));
    vector<int> vec;
    int tmp;
    for (int i = 0; i < m; i++) {
      scanf("%d", &tmp);
      vec.push_back(tmp);
    }
    scanf("%d", &sc);
    if ((int)vec.size()) g[sc][vec.back()] = g[vec.back()][sc] = true;
    tlen = 1;
    bool over = false;
    ans.clear();
    for (int i = (int)vec.size() - 1; i > 0; i--) {
      int cur = vec[i - 1], cur2 = vec[i];
      g[cur][cur2] = g[cur2][cur] = true;
      tlen++;
      for (int j = cur2 + 1; j <= n; j++) {
        if (g[cur][j]) {
          g[cur][j] = g[j][cur] = false;
          tlen--;
          if (getN() == tlen) {
            over = true;
            for (int k = 0; k < i; k++) ans.push_back(vec[k]);
            ans.push_back(j);
            getAns();
            break;
          }
          g[cur][j] = g[j][cur] = true;
          tlen++;
        }
      }
      if (over) break;
    }
    if (over) {
      assert(ans.size() == m + 1);
      for (int i = 0; i < (int)ans.size(); i++) {
        if (i != 0) printf(" ");
        printf("%d", ans[i]);
      }
      printf("\n");
    } else
      printf("No solution\n");
  }
  return 0;
}
