#include <bits/stdc++.h>
using namespace std;
int a[110][110];
int b[110][110];
vector<int> e;
int n, m, mm;
int was[110];
int par[110];
vector<int> res;
bool dfs(int v, int num, vector<int> c) {
  if (num == 0)
    if (v == e[0]) {
      res = c;
      return true;
    }
  for (int i = (0); i < (n); ++i)
    if (a[v][i]) {
      a[v][i] = 0;
      a[i][v] = 0;
      c.push_back(i);
      if (dfs(i, num - 1, c)) {
        par[i] = v;
        return true;
      }
      c.pop_back();
      a[v][i] = 1;
      a[i][v] = 1;
    }
  return false;
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = (0); i < (m + 1); ++i) {
    int b;
    scanf("%d", &b);
    b--;
    e.push_back(b);
  }
  for (int i = (0); i < (e.size() - 1); ++i) {
    a[e[i]][e[i + 1]] = 1;
    a[e[i + 1]][e[i]] = 1;
  }
  for (int it = (int)e.size() - 1; it > 0; --it) {
    for (int i = (0); i < (n); ++i)
      for (int j = (0); j < (n); ++j) b[i][j] = a[i][j];
    for (int i = (0); i < (it - 1); ++i) {
      a[e[i]][e[i + 1]] = 0;
      a[e[i + 1]][e[i]] = 0;
    }
    int v1 = e[it];
    int v = e[it - 1];
    mm = m - it;
    for (int i = (v1 + 1); i < (n); ++i)
      if (a[v][i]) {
        memset(was, 0, sizeof(was));
        memset(par, -1, sizeof(par));
        a[v][i] = 0;
        a[i][v] = 0;
        vector<int> c;
        bool f = dfs(i, mm, c);
        if (f) {
          for (int j = (0); j < (it); ++j) {
            if (j) printf(" ");
            printf("%d", e[j] + 1);
          }
          printf(" %d", i + 1);
          for (int j = (0); j < (res.size()); ++j) printf(" %d", res[j] + 1);
          printf("\n");
          return 0;
        }
        a[v][i] = 1;
      }
    for (int i = (0); i < (n); ++i)
      for (int j = (0); j < (n); ++j) a[i][j] = b[i][j];
  }
  printf("No solution\n");
  return 0;
}
