#include <bits/stdc++.h>
using namespace std;
template <class T>
T abs(T x) {
  return x > 0 ? x : -x;
}
int n;
int m;
int g[100][100], x[2001], cnt[100], was[100], y[2001];
int dfs(int x) {
  was[x] = 1;
  for (int i = 0; i < n; i++)
    if (g[x][i] && !was[i]) dfs(i);
  return 0;
}
int check(int i) {
  for (int j = 0; j < n; j++)
    if (j != y[i] && j != y[0] && (cnt[j] & 1)) return 0;
  if (y[0] == y[i] && (cnt[y[0]] & 1) ||
      y[0] != y[i] && ((cnt[y[0]] & 1) == 0 || (cnt[y[i]] & 1) == 0))
    return 0;
  memset(was, 0, sizeof(was));
  for (int j = 0; j < n; j++)
    if (cnt[j]) {
      dfs(j);
      break;
    }
  for (int j = 0; j < n; j++)
    if (!was[j] && cnt[j]) return 0;
  return 1;
}
int go(int i, int f) {
  if (i == m) {
    y[i] = y[0];
    return (1 - f) * int(g[y[i - 1]][y[i]]);
  }
  y[i] = x[i] * f;
  while (y[i] < n) {
    if (i > 0) {
      if (!g[y[i]][y[i - 1]]) {
        y[i]++;
        continue;
      }
      g[y[i]][y[i - 1]] = g[y[i - 1]][y[i]] = 0;
      cnt[y[i]]--;
      cnt[y[i - 1]]--;
    }
    if (check(i) && go(i + 1, min(f, 1 - int(y[i] > x[i])))) return 1;
    if (i > 0) {
      g[y[i]][y[i - 1]] = g[y[i - 1]][y[i]] = 1;
      cnt[y[i]]++;
      cnt[y[i - 1]]++;
    }
    y[i]++;
  }
  return 0;
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 0; i <= m; i++) {
    scanf("%d", &x[i]);
    x[i]--;
  }
  for (int i = 0; i < m; i++) {
    cnt[x[i]]++;
    cnt[x[i + 1]]++;
    g[x[i]][x[i + 1]] = g[x[i + 1]][x[i]] = 1;
  }
  y[0] = x[0];
  if (go(1, 1)) {
    for (int i = 0; i <= m; i++) printf("%d ", y[i] + 1);
    printf("\n");
  } else
    printf("No solution\n");
  return 0;
}
