#include <bits/stdc++.h>
using namespace std;
const int maxn = 105;
const int maxm = 2005;
int n, m;
vector<pair<int, int> > e;
vector<int> g[maxn];
int order[maxm];
bool mat[maxn][maxn];
void add_edge(int a, int b) {
  e.push_back(make_pair(a, b));
  g[a].push_back(b);
  g[b].push_back(a);
}
void on(int a, int b) { mat[a][b] = mat[b][a] = 1; }
void off(int a, int b) { mat[a][b] = mat[b][a] = 0; }
int degree[maxn];
bool visi[maxn];
bool ispath(int a, int b) {
  memset(visi, 0, sizeof(visi));
  queue<int> q;
  q.push(a);
  visi[a] = 1;
  while (!q.empty()) {
    int u = q.front();
    q.pop();
    for (int i = 0; i < g[u].size(); ++i) {
      int nxt = g[u][i];
      if (visi[nxt] || mat[u][nxt] == 0) continue;
      visi[nxt] = 1;
      q.push(nxt);
    }
  }
  return visi[b];
}
bool iseuler(int a, int b) {
  memset(degree, 0, sizeof(degree));
  for (int i = 0; i < e.size(); ++i)
    if (mat[e[i].first][e[i].second])
      degree[e[i].first]++, degree[e[i].second]++;
  if (a != b)
    if (degree[a] % 2 == 0 || degree[b] % 2 == 0) return 0;
  bool ok = 1;
  if (a != b)
    for (int i = 0; i < n; ++i) {
      if (i != a && i != b && degree[i] % 2) ok = 0;
    }
  else
    for (int i = 0; i < n; ++i) {
      if (degree[i] % 2) ok = 0;
    }
  if (!ok || !ispath(a, b)) return 0;
  for (int i = 0; i < e.size(); ++i) {
    if (mat[e[i].first][e[i].second] == 0) continue;
    if (visi[e[i].first] == 0 || visi[e[i].second] == 0) return 0;
  }
  return 1;
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 0; i <= m; ++i) {
    scanf("%d", &order[i]);
    order[i]--;
    if (i) add_edge(order[i], order[i - 1]);
  }
  int x, y = -1;
  for (int i = m; i >= 1 && y == -1; --i) {
    on(order[i], order[i - 1]);
    for (int k = order[i] + 1; k < n && y == -1; ++k) {
      if (mat[order[i - 1]][k] == false) continue;
      off(order[i - 1], k);
      if (iseuler(k, order[0])) x = i, y = k;
      on(order[i - 1], k);
    }
  }
  if (y == -1) {
    printf("No solution\n");
    return 0;
  }
  order[x] = y;
  off(order[x - 1], y);
  for (int i = x + 1; i <= m; ++i) {
    for (int j = 0; j < n; ++j) {
      if (mat[order[i - 1]][j] == 0) continue;
      off(order[i - 1], j);
      if (iseuler(j, order[0])) {
        order[i] = j;
        break;
      }
      on(order[i - 1], j);
    }
  }
  for (int i = 0; i <= m; ++i) printf("%d ", order[i] + 1);
  printf("\n");
  return 0;
}
