#include <bits/stdc++.h>
using namespace std;
int C[3000];
int A[200][200];
int B[200];
int n, m;
bool Check(int q, int w) {
  A[q][w] = A[w][q] = 0;
  B[q]--;
  B[w]--;
  int i, j;
  int V[200];
  int Q[200], sq = 0;
  memset(V, 0, sizeof(V));
  V[w] = 1;
  Q[0] = w;
  sq = 1;
  for (i = 0; i < sq; i++) {
    for (j = 0; j < n + 1; j++)
      if ((V[j] == 0) && (A[Q[i]][j] == 1)) {
        V[j] = 1;
        Q[sq] = j;
        sq++;
      }
  }
  for (i = 0; i < n + 1; i++)
    if ((B[i] != 0) && (V[i] == 0)) break;
  B[q]++;
  B[w]++;
  A[q][w] = A[w][q] = 1;
  if (i == n + 1)
    return true;
  else
    return false;
}
int main() {
  int i, j, k, p;
  scanf("%d%d", &n, &m);
  for (i = 0; i < m + 1; i++) scanf("%d", &C[i]);
  memset(A, 0, sizeof(A));
  memset(B, 0, sizeof(B));
  int odd = 0;
  for (p = m - 1; p >= 0; p--) {
    A[C[p]][C[p + 1]] = A[C[p + 1]][C[p]] = 1;
    B[C[p]]++;
    if (B[C[p]] % 2 == 1)
      odd++;
    else
      odd--;
    B[C[p + 1]]++;
    if (B[C[p + 1]] % 2 == 1)
      odd++;
    else
      odd--;
    if (odd > 2) continue;
    if ((odd == 2) && (B[C[0]] % 2 == 0)) continue;
    for (i = C[p + 1] + 1; i < n + 1; i++)
      if (A[C[p]][i] == 1) {
        if (Check(C[p], i)) {
          while (p != m) {
            A[C[p]][i] = A[i][C[p]] = 0;
            B[C[p]]--;
            B[i]--;
            p++;
            C[p] = i;
            for (i = 0; i < n + 1; i++)
              if ((A[C[p]][i] == 1) && (Check(C[p], i))) break;
          }
          for (i = 0; i < m + 1; i++) printf("%d ", C[i]);
          return 0;
        }
      }
  }
  printf("No solution");
  return 0;
}
