#include <bits/stdc++.h>
bool debug = false;
using namespace std;
long long convertToNum(string s) {
  long long val = 0;
  for (int i = 0; i < (s.size()); i++) val = val * 10 + s[i] - '0';
  return val;
}
string convertToString(long long a) {
  string res = "";
  if (!a) return "0";
  while (a) {
    res = (char)(a % 10 + 48) + res;
    a /= 10;
  }
  return res;
}
long long GCD(long long x, long long y) {
  if (!x) return y;
  if (!y) return x;
  if (x == y) return x;
  if (x < y)
    return GCD(x, y % x);
  else
    return GCD(x % y, y);
}
long long POW(long long x, long long y, long long Base) {
  if (!y) return 1;
  long long u = POW(x, y / 2, Base);
  u = (u * u) % Base;
  if (y & 1)
    return (u * x) % Base;
  else
    return u;
}
int x[5000];
vector<pair<int, bool> > a[200];
vector<int> pos[200];
vector<pair<int, bool> > b[200];
bool Bridge[200][200];
int n, m, root;
int deg[200], num[200], low[200], dem;
int Stack[5000], top;
void addcanh(int x, int y) {
  pos[x].push_back(a[y].size());
  pos[y].push_back(a[x].size());
  a[x].push_back(make_pair(y, true));
  a[y].push_back(make_pair(x, true));
  deg[x]++;
  deg[y]++;
}
int canh[200][200];
void dfs(int u) {
  num[u] = ++dem;
  low[u] = n + 1;
  for (int i = 0; i < (a[u].size()); i++) {
    int next = b[u][i].first;
    if (!b[u][i].second) continue;
    b[next][pos[u][i]].second = false;
    if (!num[next]) {
      dfs(next);
      low[u] = min(low[u], low[next]);
      if (low[next] >= num[next]) Bridge[u][next] = Bridge[next][u] = true;
    } else
      low[u] = min(low[u], num[next]);
  }
}
void findBridge() {
  for (int i = (1); i <= (n); i++) b[i] = a[i];
  for (int i = (1); i <= (n); i++)
    for (int j = (1); j <= (n); j++) Bridge[i][j] = false;
  dem = 0;
  for (int i = (1); i <= (n); i++) num[i] = low[i] = 0;
  for (int i = (1); i <= (n); i++)
    if (!num[i]) dfs(i);
}
bool check(int cur, int index) {
  int cnt = 0;
  for (int i = (1); i <= (n); i++)
    if (deg[i] % 2) cnt++;
  if (cnt == 0 && cur != root) return false;
  if (cnt > 2) return false;
  if (cnt == 2) {
    if (deg[cur] % 2 == 0) return false;
    if (deg[root] % 2 == 0) return false;
  }
  vector<int> res(0);
  for (int i = (1); i <= (index); i++) res.push_back(x[i]);
  res.push_back(cur);
  while (res.size() < m) {
    findBridge();
    int nBridge = 0, nEdge = 0;
    for (int j = 0; j < (a[cur].size()); j++) {
      int next = a[cur][j].first;
      if (!a[cur][j].second) continue;
      nEdge++;
      if (Bridge[cur][next]) nBridge++;
    }
    bool canBridge;
    if (nBridge == nEdge)
      canBridge = true;
    else
      canBridge = false;
    int N = 1000000009;
    for (int j = 0; j < (a[cur].size()); j++) {
      if (!a[cur][j].second) continue;
      int next = a[cur][j].first;
      if (!canBridge && Bridge[cur][next]) continue;
      N = min(N, next);
    }
    for (int j = 0; j < (a[cur].size()); j++) {
      if (!a[cur][j].second) continue;
      int next = a[cur][j].first;
      if (!canBridge && Bridge[cur][next]) continue;
      if (next != N) continue;
      a[cur][j].second = false;
      a[next][pos[cur][j]].second = false;
      cur = next;
      res.push_back(cur);
      break;
    }
  }
  for (int i = 0; i < (res.size()); i++) cout << res[i] << " ";
  return true;
}
int main() {
  cin >> n >> m;
  m++;
  for (int i = (1); i <= (m); i++) cin >> x[i];
  root = x[1];
  for (int i = (m - 2); i >= (1); i--) {
    for (int j = (1); j <= (n); j++) a[j].clear();
    for (int j = (1); j <= (n); j++) pos[j].clear();
    for (int j = (1); j <= (n); j++) deg[j] = 0;
    for (int j = (i); j <= (m - 1); j++) addcanh(x[j], x[j + 1]);
    findBridge();
    int cur = x[i];
    int nBridge = 0, nEdge = 0;
    for (int j = 0; j < (a[cur].size()); j++) {
      int next = a[cur][j].first;
      if (!a[cur][j].second) continue;
      nEdge++;
      if (Bridge[cur][next]) nBridge++;
    }
    bool canBridge;
    if (nBridge == nEdge)
      canBridge = true;
    else
      canBridge = false;
    vector<pair<int, int> > dd(0);
    for (int j = 0; j < (a[cur].size()); j++) {
      int next = a[cur][j].first;
      if (!a[cur][j].second) continue;
      if (next <= x[i + 1]) continue;
      if (!canBridge && Bridge[cur][next]) continue;
      dd.push_back(make_pair(next, j));
    }
    sort(dd.begin(), dd.end());
    for (int t = 0; t < (dd.size()); t++) {
      int j = dd[t].second;
      int next = dd[t].first;
      a[cur][j].second = false;
      a[next][pos[cur][j]].second = false;
      deg[next]--;
      deg[cur]--;
      if (check(next, i)) return 0;
      deg[next]++;
      deg[cur]++;
      a[cur][j].second = true;
      a[next][pos[cur][j]].second = true;
    }
  }
  cout << "No solution" << endl;
  return 0;
}
