#include <bits/stdc++.h>
using namespace std;
int n, m;
bool tcan[105][105] = {};
bool can[105][105] = {};
int ans[5000];
int way[5000], top = 0;
int euler_path(int pos) {
  int ret = 1;
  for (int i = 1; i <= n; i++) {
    if (tcan[pos][i]) {
      tcan[pos][i] = tcan[i][pos] = false;
      ret += euler_path(i);
    }
  }
  ans[top++] = pos;
  return ret;
}
bool DFS(int pos, int cur = 0) {
  if (cur == m) {
    return false;
  }
  if (way[cur] != pos) {
    top = 0;
    memcpy(tcan, can, sizeof can);
    return (euler_path(pos) + cur) == m + 1;
  }
  for (int i = way[cur + 1]; i <= n; i++) {
    if (can[pos][i]) {
      can[pos][i] = can[i][pos] = false;
      if (DFS(i, cur + 1)) {
        ans[top++] = pos;
        return true;
      }
      can[pos][i] = can[i][pos] = true;
    }
  }
  return false;
}
int main() {
  cin >> n >> m;
  int f;
  cin >> f;
  way[0] = f;
  for (int i = 0; i < m; i++) {
    int s;
    cin >> s;
    way[i + 1] = s;
    can[f][s] = can[s][f] = true;
    f = s;
  }
  if (DFS(way[0])) {
    cout << way[0] << " ";
    for (int i = m - 1; i >= 0; i--) {
      cout << ans[i] << " ";
    }
  } else {
    cout << "No solution\n";
  }
  return 0;
}
