#include <bits/stdc++.h>
using namespace std;
int in[2001];
set<int> path[201];
int done[201];
int f = 1;
int ng0, ng1;
void dfs(int i) {
  done[i] = f;
  for (auto j : path[i]) {
    if (done[j] != f) {
      if (i == ng1 && j == ng0) {
        continue;
      }
      dfs(j);
    }
  }
}
vector<int> search(int i) {
  vector<int> ret;
  ret.push_back(i);
  while (path[i].size()) {
    int t = 0;
    for (auto j : path[i]) {
      ng0 = i;
      ng1 = j;
      dfs(j);
      bool ok = true;
      for (auto k : path[i]) {
        if (done[k] != f) {
          ok = false;
          break;
        }
      }
      f++;
      if (ok) {
        t = j;
        break;
      }
    }
    path[i].erase(t);
    path[t].erase(i);
    i = t;
    ret.push_back(t);
  }
  return ret;
}
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  for (int i = 0; i <= m; i++) {
    scanf("%d", in + i);
  }
  for (int i = m; i >= 1; i--) {
    int s = in[i - 1];
    int e = in[i];
    path[s].insert(e);
    path[e].insert(s);
    int t = 0;
    for (auto j : path[s]) {
      if (j > e) {
        ng0 = s;
        ng1 = j;
        dfs(j);
        bool ok = true;
        for (auto k : path[s]) {
          if (done[k] != f) {
            ok = false;
            break;
          }
        }
        f++;
        if (ok) {
          t = j;
          break;
        }
      }
    }
    if (t > 0) {
      path[s].erase(t);
      path[t].erase(s);
      auto r = search(t);
      auto sp = "";
      for (int j = 0; j < i; j++) {
        printf("%s%d", sp, in[j]);
        sp = " ";
      }
      for (auto j : r) {
        printf("%s%d", sp, j);
        sp = " ";
      }
      puts("");
      return 0;
    }
  }
  puts("No solution");
  return 0;
}
