#include <bits/stdc++.h>
using namespace std;
bool used[101][101];
int r[2001];
vector<int> nr;
bool dfs(int s, int p, bool bigg, int n, int m) {
  nr.push_back(s);
  bool ok;
  if (p == m + 1) {
    if (bigg)
      return 1;
    else {
      nr.pop_back();
      return 0;
    }
  }
  if (bigg) {
    for (int i = 1; i <= n; i++) {
      if (used[s][i]) {
        used[s][i] = used[i][s] = 0;
        ok = dfs(i, p + 1, bigg, n, m);
        if (ok) return 1;
        used[s][i] = used[i][s] = 1;
      }
    }
  } else {
    for (int i = r[p]; i <= n; i++) {
      if (used[s][i]) {
        used[s][i] = used[i][s] = 0;
        ok = (i == r[p] ? dfs(i, p + 1, bigg, n, m) : dfs(i, p + 1, 1, n, m));
        if (ok) return 1;
        used[s][i] = used[i][s] = 1;
      }
    }
  }
  nr.pop_back();
  return 0;
}
int main() {
  int n, m;
  scanf("%d %d", &n, &m);
  scanf("%d", &r[0]);
  for (int i = 1; i <= m; i++) {
    scanf("%d", &r[i]);
    used[r[i]][r[i - 1]] = used[r[i - 1]][r[i]] = 1;
  }
  if (dfs(r[0], 1, 0, n, m)) {
    for (int i = 0; i <= m - 1; i++) {
      printf("%d ", nr[i]);
    }
    printf("%d\n", nr[m]);
  } else {
    printf("No solution\n");
  }
}
