g | x | w | all
Bytes Lang Time Link
208Python3250331T180102ZAjax1234
035Charcoal181110T223930ZNeil
087Haskell181110T073704Znimi
068Perl 6181110T001914ZJo King
012Jelly181109T235531ZJonathan

Python3, 208 bytes

R=range
def f(n,O):
 q,s=[[]],[]
 for i in q:
  if len(i)==n-1:s+=[i];continue
  for I in R(1,n):
   t=i+[I]
   if all(sum(t[j:k])%n!=0for j in R(len(t))for k in R(j+1,len(t)+1)):q+=[t]
 return sorted(s)[O-1]

Try it online!

Charcoal, 35 bytes

NθI↨§Φ…Xθ⁻θ²Xθ⊖θ¬ΦθΦλ¬﹪Σ✂↨ιθνλ¹θ⊖ηθ

Try it online! Link is to verbose version of code. Works by taking the range \$ n^{n-2} \ldots n^{n-1}-1 \$ in base \$ n \$ and filtering out illegal sequences (including ones with zero digits). Explanation:

N                                   Input `n` as a number
 θ                                  Save in variable
        θ                           `n`
       X                            To the power
          θ                         `n`
         ⁻                          Minus
           ²                        2
      …                             Ranged up to
             θ                      `n`
            X                       To the power
               θ                    `n`
              ⊖                     Decremented
     Φ                              Filtered `i` by
                ¬                   Not
                  θ                 Implicit range `0` .. `n-1`
                 Φ                  Filtered `l` by
                    λ               Implicit range `0` .. `l`
                   Φ                Filtered `m` by
                     ¬              Not
                       Σ            Sum
                          ι         `i`
                         ↨          Converted to base
                           θ        `q`
                        ✂           Sliced
                            ν       From `m`
                             λ      To `l`
                              ¹     Step 1
                      ﹪             Modulo
                               θ    `n`
    §                               Indexed by
                                 η  Second input `k`
                                ⊖   Decremented
   ↨                                Converted to base
                                  θ `n`
  I                                 Cast to string
                                    Implicitly printed

Haskell, 87 bytes

n#k=[d|d<-mapM id$[1..n]<$[2..n],all(\x->mod x n>0)$p d]!!k
p(x:y)=scanl(+)x<>p$y
p x=x

Uses 0-based indexing. Needs the latest version of Prelude which is not installed on TIO, hence an additional import.

Try it online!

   d|d<-mapM id$[1..n]<$[2..n]    -- keep all 'd' from the lists of numbers [1..n] of
                                  -- length n-1
     , all(\x->      )            -- where all elements 'x' from
                       p d        -- the sums of the subsequences of 'd'
               mod x n>0          -- are not a multiple of n
 [                           ]!!k -- pick the 'k'th element

p(x:y)=scanl(+)x<>p$y             -- the sums of subsequences are calculated by
                                  -- prepending the cumulative sums of the list to
                                  -- a recursive call with the tail of the list
p x=x                             -- base case for recursion: empty list

Perl 6, 74 68 bytes

{([X] (1..^$^a)xx$a-1).grep(!*[^*X.. ^*].grep:{$_&.sum%%$a})[$^b-1]}

Try it online!

Anonymous code block that returns a list of numbers, or an integer in the case of \$n=2\$.

Explanation:

{([X] (1..^$^a)xx$a-1).grep(!*[^*X.. ^*].grep:{$_&.sum%%$a})[$^b-1]}
{                                                                  }  # Anonymous code block
 ([X] (1..^$^a)xx$a-1)  # From all n length sequences of 1 to n-1
                      .grep(                               )   # Filter by
                            !           .grep:{          }  # None of
                             *[^*X.. ^*]    # All partitions (including empty lists)
                                               $_    # Are non-empty
                                                 &.sum%%$a  # And the sum is divisible by n
                                                            [$^b-1]  # Get the kth index of the list

Jelly, 12 bytes

’ṗ`Ẇ§%ẠʋƇ⁸ị@

A dyadic Link accepting n on the left and k on the right.

Try it online! (no way this will work for large n, but would in theory)

How?

’ṗ`Ẇ§%ẠʋƇ⁸ị@ - Link: integer n, integer k
’            - decrement n -> n-1
  `          - use for both arguments of:
 ṗ           -   Cartesian power (all (n-1)^2 flower sequences - lex order)
         ⁸   - chain's left argument, n (as right argument for...)
        Ƈ    - filter keep those (sequences) which are truthy under:
       ʋ     -   last four links as a dyad (f(sequence, n)):
   Ẇ         -     all ((n-1)n/2) contiguous sublists (of the sequence)
    §        -     sum each
     %       -     modulo (n)
      Ạ      -     all? (all non-zero?)
           @ - with swapped arguments (i.e. f(k, listOfValidSequences)
          ị  -   index into (1-based)