#include <bits/stdc++.h>
const int kMaxN = 100, kMaxM = 2000;
std::vector<int> way[kMaxN];
bool used[kMaxN][kMaxN];
int a[kMaxM + 1], deg[kMaxN];
int n, m, cnt;
void ReadIn() {
  scanf("%d%d", &n, &m);
  for (int i = 0; i <= m; ++i) {
    scanf("%d", &a[i]);
    --a[i];
  }
}
inline void AddEdge(int u, int v) {
  way[u].push_back(v);
  way[v].push_back(u);
  std::sort(way[u].begin(), way[u].end());
  std::sort(way[v].begin(), way[v].end());
  ++cnt;
}
bool Check(int cnt, int u, int v) {
  if (u == v) return true;
  if (!(deg[u] & 1))
    ++cnt;
  else
    --cnt;
  if (!(deg[v] & 1))
    ++cnt;
  else
    --cnt;
  return cnt == 0 || cnt == 2;
}
bool dfs(int step, int u, int cnt, int b = -1) {
  if (step == m + 1) return true;
  for (__typeof__(way[u].begin()) ptr = way[u].begin(); ptr != way[u].end();
       ++ptr) {
    int v = *ptr;
    if (v <= b || used[u][v] || !Check(cnt, u, v)) continue;
    a[step] = v;
    --deg[u];
    --deg[v];
    if (u != v) {
      if (deg[u] & 1)
        ++cnt;
      else
        --cnt;
      if (deg[v] & 1)
        ++cnt;
      else
        --cnt;
    }
    used[u][v] = used[v][u] = true;
    if (dfs(step + 1, v, cnt)) return true;
    ++deg[u];
    ++deg[v];
    if (u != v) {
      if (deg[u] & 1)
        ++cnt;
      else
        --cnt;
      if (deg[v] & 1)
        ++cnt;
      else
        --cnt;
    }
    used[u][v] = used[v][u] = false;
  }
  return false;
}
void Output() {
  for (int i = 0; i <= m; ++i) {
    if (i != 0) printf(" ");
    printf("%d", a[i] + 1);
  }
  puts("");
}
void Solve() {
  for (int i = m - 1; i >= 0; --i) {
    int amount = 0;
    AddEdge(a[i], a[i + 1]);
    for (int j = 0; j < n; ++j) {
      deg[j] = (int)way[j].size();
      if (deg[j] & 1) ++amount;
    }
    memset(used, false, sizeof(used));
    if (dfs(i + 1, a[i], amount, a[i + 1])) {
      Output();
      return;
    }
  }
  puts("No solution");
}
int main() {
  ReadIn();
  Solve();
  return 0;
}
