#include <bits/stdc++.h>
using namespace std;
int p[3000], n, m;
vector<int> E[101];
vector<int> path;
void tour(int u) {
  while (!E[u].empty()) {
    int v = E[u][0];
    E[u].erase(E[u].begin());
    E[v].erase(find(E[v].begin(), E[v].end(), u));
    tour(v);
  }
  path.push_back(u);
}
int seen[101];
void dfs(int u) {
  if (seen[u]) return;
  seen[u] = true;
  for (int i = 0; i < E[u].size(); i++) dfs(E[u][i]);
}
int main() {
  scanf("%d %d", &n, &m);
  for (int i = 0; i <= m; i++) scanf("%d", p + i);
  int sz = 0;
  for (int i = m - 1; i >= 0; i--) {
    E[p[i]].push_back(p[i + 1]);
    E[p[i + 1]].push_back(p[i]);
    sort(E[p[i]].begin(), E[p[i]].end());
    sort(E[p[i + 1]].begin(), E[p[i + 1]].end());
    for (int o = 0; o < E[p[i]].size(); o++)
      if (E[p[i]][o] > p[i + 1]) {
        int x = E[p[i]][o];
        E[p[i]].erase(E[p[i]].begin() + o);
        E[x].erase(find(E[x].begin(), E[x].end(), p[i]));
        bool sirve = true;
        int parity = 1;
        if (E[x].size() % 2 != parity) sirve = false;
        if (E[p[0]].size() % 2 != parity) sirve = false;
        for (int j = 1; j <= n; j++)
          if (j != x && j != p[0] && E[j].size() % 2 == 1) sirve = false;
        memset(seen, 0, sizeof seen);
        dfs(x);
        for (int j = 1; j <= n; j++)
          if (E[j].size() > 0 && !seen[j]) sirve = false;
        if (sirve) {
          tour(x);
          reverse(path.begin(), path.end());
          sz = i + 1;
          for (int j = 0; j < path.size(); j++) p[sz++] = path[j];
          goto end;
        }
        E[p[i]].push_back(x);
        E[x].push_back(p[i]);
        sort(E[p[i]].begin(), E[p[i]].end());
        sort(E[x].begin(), E[x].end());
      }
  }
end:
  if (sz == 0)
    cout << "No solution";
  else
    for (int i = 0; i < sz; i++) {
      if (i) printf(" ");
      printf("%d", p[i]);
    }
  cout << endl;
}
