#include <bits/stdc++.h>
using namespace std;
int n, m, r[2012], ans[2012];
set<int> p[110];
bool e[2012][2012];
bool flag;
bool dfs(int x, int now, bool M) {
  if (now > m) {
    if (!M || x != r[1]) return false;
    flag = true;
    for (int i = 1; i <= m; i++) cout << ans[i] << ' ';
    cout << ans[1] << endl;
    return true;
  }
  ans[now] = x;
  if (M) {
    for (set<int>::iterator iter = p[x].begin(); iter != p[x].end(); iter++) {
      if (e[x][*iter]) continue;
      e[x][*iter] = e[*iter][x] = true;
      if (dfs(*iter, now + 1, M)) return true;
      e[x][*iter] = e[*iter][x] = false;
    }
  } else {
    e[x][r[now + 1]] = e[r[now + 1]][x] = true;
    if (dfs(r[now + 1], now + 1, M)) return true;
    e[x][r[now + 1]] = e[r[now + 1]][x] = false;
    for (set<int>::iterator iter = p[x].lower_bound(r[now + 1] + 1);
         iter != p[x].end(); iter++) {
      if (e[x][*iter]) continue;
      e[x][*iter] = e[*iter][x] = true;
      if (dfs(*iter, now + 1, true)) return true;
      e[x][*iter] = e[*iter][x] = false;
    }
  }
  return false;
}
int main() {
  cin.sync_with_stdio(false);
  cin >> n >> m;
  for (int i = 1; i <= m; i++) cin >> r[i];
  r[m + 1] = n + 1;
  for (int i = 1; i < m; i++)
    p[r[i]].insert(r[i + 1]), p[r[i + 1]].insert(r[i]);
  p[r[1]].insert(r[m]);
  p[r[m]].insert(r[1]);
  flag = dfs(r[1], 1, false);
  if (!flag) cout << "No solution" << endl;
}
