#include <bits/stdc++.h>
using namespace std;
const int h = 2020;
const int o = 101;
const int H = 1000000000;
int n, m, r[h], f[o][o], F;
bool e[o][o];
vector<int> v[o], res;
void eul(int u) {
  for (int i = 0; i < v[u].size(); i++)
    if (f[u][v[u][i]] != F) {
      f[u][v[u][i]] = F;
      f[v[u][i]][u] = F;
      eul(v[u][i]);
    }
  res.push_back(u);
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 0; i <= m; i++) scanf("%d", &r[i]);
  for (int p = m - 1; p > 0; p--) {
    for (int i = 0; i <= n; i++) v[i].resize(0);
    memset(f, 0, sizeof f);
    memset(e, 0, sizeof e);
    for (int i = p - 1; i < m; i++) {
      v[r[i]].push_back(r[i + 1]);
      v[r[i + 1]].push_back(r[i]);
      e[r[i]][r[i + 1]] = e[r[i + 1]][r[i]] = 1;
    }
    for (int i = 0; i <= n; i++) sort(v[i].begin(), v[i].end());
    for (int j = r[p] + 1; j <= n; j++) {
      if (e[r[p - 1]][j] == 0) continue;
      F = j;
      f[r[p - 1]][j] = F;
      f[j][r[p - 1]] = F;
      res.resize(0);
      eul(j);
      if (res.size() == m - p + 1) {
        for (int i = 0; i < p; i++) printf("%d ", r[i]);
        for (int i = res.size() - 1; i >= 0; i--) printf("%d ", res[i]);
        return 0;
      }
      f[r[p - 1]][j] = 0;
      f[j][r[p - 1]] = 0;
    }
  }
  puts("No solution");
  return 0;
}
