#include <bits/stdc++.h>
using namespace std;
const long long int MOD = 1e9 + 7;
bool IsPowerOfTwo(long long int x) { return (x != 0) && ((x & (x - 1)) == 0); }
long long int poer(long long int a, long long int b) {
  long long int rs = 1;
  while (b > 0) {
    if (b & 1) rs *= a;
    a *= a;
    b /= 2;
  }
  return rs;
}
long long int mod_poer(long long int a, long long int b, long long int mo) {
  long long int rs = 1;
  while (b > 0) {
    if (b & 1) rs = (rs * a) % mo;
    a = (a * a) % mo;
    b /= 2;
  }
  return rs % mo;
}
long long int d, x, y;
void ext_euclid(long long int a, long long int b) {
  if (b == 0) {
    d = a;
    x = 1;
    y = 0;
  } else {
    ext_euclid(b, a % b);
    long long int temp = x;
    x = y;
    y = temp - (a / b) * y;
  }
}
long long int mod_inverse1(long long int a, long long int m) {
  ext_euclid(a, m);
  return (x % m + m) % m;
}
long long int mod_inverse2(long long int a, long long int m) {
  return mod_poer(a, m - 2, m);
}
long long int gcd(long long int a, long long int b) {
  if (b == 0)
    return a;
  else
    return gcd(b, a % b);
}
long long int fact[200005];
void fac() {
  fact[1] = fact[0] = 1;
  for (long long int i = 2; i <= 200005; ++i) {
    fact[i] = ((fact[i - 1] % MOD) * i) % MOD;
  }
}
long long int combi(long long int a, long long int b) {
  if (b > a) return 0;
  if (b == a)
    return 1;
  else {
    long long int x = mod_poer(fact[b], MOD - 2, MOD) % MOD;
    long long int y = mod_poer(fact[a - b], MOD - 2, MOD) % MOD;
    return ((((fact[a]) * x) % MOD) * y) % MOD;
  }
}
long long int n, m, s, path[2005], ans[2005];
long long int vis[105][105];
long long int flg;
vector<long long int> adj[105];
void dfs(long long int now, long long int cnt, long long int pre) {
  ans[cnt] = now;
  if (cnt > m) return;
  if (cnt == m && path[0] == ans[0] && ans[0] == ans[m] && pre) {
    flg = 1;
    return;
  }
  for (long long int i = 0; i < adj[now].size(); ++i) {
    long long int re = adj[now][i];
    if (vis[now][re] == 0 && vis[re][now] == 0) {
      if (pre == 0 && re < path[cnt + 1]) continue;
      if (re > path[cnt + 1]) pre = 1;
      vis[now][re] = 1;
      vis[re][now] = 1;
      dfs(re, cnt + 1, pre);
      if (flg) return;
      vis[now][re] = 0;
      vis[re][now] = 0;
    }
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  scanf("%lld%lld", &n, &m);
  memset(vis, 0, sizeof(vis));
  scanf("%lld", &path[0]);
  flg = 0;
  for (long long int i = 1; i <= m; ++i) {
    scanf("%lld", &path[i]);
    adj[path[i]].push_back(path[i - 1]);
    adj[path[i - 1]].push_back(path[i]);
  }
  for (long long int i = 0; i <= n; ++i) sort(adj[i].begin(), adj[i].end());
  dfs(path[0], 0, 0);
  if (flg) {
    for (long long int i = 0; i <= m; ++i) printf("%lld ", ans[i]);
  } else
    printf("No solution\n");
  return 0;
}
