#include <bits/stdc++.h>
using namespace std;
vector<int> v[2000], ans, t;
int n;
bool ch[4000];
bool dfs(int s, int t) {
  ch[s] = 1;
  if (s == t) return 1;
  for (int i = 0; i < v[s].size(); i++) {
    if (!ch[v[s][i]])
      if (dfs(v[s][i], t)) return 1;
  }
  return 0;
}
int BS(int l, int r, int s, int n) {
  if (l + 1 == r) {
    if (v[s][r] == n) return r;
    return l;
  }
  int m = (r + l) / 2;
  if (v[s][m] == n) return m;
  if (v[s][m] > n) return BS(l, m, s, n);
  return BS(m, r, s, n);
}
void chap() {
  for (int i = 1; i <= n; i++) {
    cout << i << ":";
    for (int j = 0; j < v[i].size(); j++) cout << v[i][j] << ' ';
    cout << endl;
  }
  cout << endl;
}
void rikhtan(int i) {
  int b = t[i];
  for (int j = i - 1; j >= 0; j--) {
    int a = t[j];
    v[a].push_back(b);
    v[b].push_back(a);
    b = a;
  }
}
void flory(int s) {
  if (ans.size() == t.size()) return;
  int i = 0;
  for (i = 0; i < v[s].size(); i++) {
    vector<int> t1 = v[s], t2 = v[v[s][i]];
    int k = BS(0, v[v[s][i]].size() - 1, v[s][i], s);
    int d = v[s][i];
    v[d].erase(v[d].begin() + k, v[d].begin() + k + 1);
    v[s].erase(v[s].begin() + i, v[s].begin() + i + 1);
    fill(ch, ch + 300, 0);
    if (dfs(s, d)) {
      ans.push_back(d);
      i = 10000;
    } else {
      v[s] = t1;
      v[d] = t2;
    }
  }
  if (i > 5000)
    flory(ans[ans.size() - 1]);
  else {
    ans.push_back(v[s][0]);
    int d = v[s][0], k = BS(0, v[d].size() - 1, d, s);
    v[d].erase(v[d].begin() + k, v[d].begin() + k + 1);
    v[s].erase(v[s].begin(), v[s].begin() + 1);
    flory(d);
  }
}
int main() {
  int m, b;
  cin >> n >> m >> b;
  t.push_back(b);
  for (int i = 0; i < m; i++) {
    int a;
    cin >> a;
    t.push_back(a);
  }
  bool ch8 = 0;
  for (int i = t.size() - 1; i > 0; i--) {
    bool ch3 = 0;
    int t1 = t[i];
    int s = t[i - 1];
    fill(ch, ch + 300, 0);
    if (v[s].size())
      if (v[s][v[s].size() - 1] > t1)
        if (dfs(s, t1)) {
          int o = 0;
          bool ch4 = 0;
          ch3 = 1;
          v[t1].push_back(s);
          v[s].push_back(t1);
          sort(v[t1].begin(), v[t1].end());
          sort(v[s].begin(), v[s].end());
          for (int j = 0; j < v[s].size(); j++) {
            if (v[s][j] <= t1) continue;
            int d = v[s][j];
            vector<int> t5 = v[s], t2 = v[v[s][j]];
            fill(ch, ch + 300, 0);
            v[s].erase(v[s].begin() + j, v[s].begin() + j + 1);
            int k = BS(0, v[d].size() - 1, d, s);
            v[d].erase(v[d].begin() + k, v[d].begin() + k + 1);
            if (dfs(s, d)) {
              ch4 = 1;
              o = d;
              j = 11111111;
            } else {
              v[s] = t5;
              v[d] = t2;
            }
          }
          if (!ch4) continue;
          ch8 = 1;
          for (int k = 0; k < i; k++) ans.push_back(t[k]);
          ans.push_back(o);
          i = -11111111;
          ch8 = 1;
        }
    if (!ch3) {
      v[t1].push_back(s);
      v[s].push_back(t1);
      sort(v[t1].begin(), v[t1].end());
      sort(v[s].begin(), v[s].end());
    }
  }
  if (!ch8) {
    cout << "No solution";
    cout << endl;
    return 0;
  }
  int s = ans[ans.size() - 1], i = 0;
  for (int i = 0; i <= n; i++) sort(v[i].begin(), v[i].end());
  flory(s);
  for (int i = 0; i < ans.size(); i++) cout << ans[i] << " ";
  cout << endl;
  return 0;
}
