#include <bits/stdc++.h>
using namespace std;
int s[2200], n, m;
int a[110][110];
int d[110][110];
int deg[110];
void add_edge(int u, int v) {
  --d[u][v];
  --d[v][u];
  ++deg[u];
  ++deg[v];
}
void del_edge(int u, int v) {
  ++d[u][v];
  ++d[v][u];
  --deg[u];
  --deg[v];
}
int sz_comp;
bool visit[110];
void dfs(int u) {
  ++sz_comp;
  visit[u] = true;
  for (int v = 0; v < n; ++v) {
    if (!visit[v] && d[u][v] < a[u][v]) {
      dfs(v);
    }
  }
}
bool connected(int x, int y) {
  memset(visit, 0, sizeof(visit));
  int cnt = 0;
  for (int u = 0; u < n; ++u) {
    if (!visit[u]) {
      sz_comp = 0;
      dfs(u);
      if (sz_comp > 1 || u == x || u == y) ++cnt;
      if (cnt > 1) return false;
    }
  }
  return true;
}
bool euler(int x, int y) {
  if (x == y) {
    for (int i = 0; i < n; ++i) {
      if (deg[i] % 2 == 1) return false;
    }
    return connected(x, y);
  } else {
    for (int i = 0; i < n; ++i) {
      if (i != x && i != y && deg[i] % 2 == 1) return false;
    }
    if (deg[x] % 2 == 0) return false;
    if (deg[y] % 2 == 0) return false;
    return connected(x, y);
  }
}
bool can_fix(int p) {
  int u = s[p - 1];
  add_edge(u, s[p]);
  for (int v = s[p] + 1; v < n; ++v) {
    if (d[u][v] < a[u][v]) {
      del_edge(u, v);
      if (euler(v, s[0])) {
        s[p] = v;
        return true;
      }
      add_edge(u, v);
    }
  }
  return false;
}
void go_fix(int p) {
  int u = s[p - 1];
  for (int v = 0; v < n; ++v) {
    if (d[u][v] < a[u][v]) {
      del_edge(u, v);
      if (euler(v, s[0])) {
        s[p] = v;
        return;
      }
      add_edge(u, v);
    }
  }
}
void go_solve(int p) {
  for (int i = 0; i <= p; ++i) {
    printf("%d ", s[i] + 1);
  }
  for (int i = p + 1; i <= m; ++i) {
    go_fix(i);
    printf("%d ", s[i] + 1);
  }
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 0; i < m + 1; ++i) {
    scanf("%d", &s[i]);
    --s[i];
  }
  memset(a, 0, sizeof(a));
  memset(d, 0, sizeof(d));
  for (int i = 0; i < m; ++i) {
    int u = s[i], v = s[i + 1];
    ++a[u][v];
    ++a[v][u];
    ++d[u][v];
    ++d[v][u];
  }
  memset(deg, 0, sizeof(deg));
  bool has_sol = false;
  for (int i = m; i >= 1; --i) {
    if (can_fix(i)) {
      has_sol = true;
      go_solve(i);
      break;
    }
  }
  if (!has_sol) {
    cout << "No solution" << endl;
  }
  return 0;
}
