Charcoal, 30 29 28 bytes
NθNηIEXθηE÷ιXθ⮌…⁰η⌊﹪⟦⊖±λλ⟧⊗θ
Try it online! Link is to verbose version of code. Outputs each digit of the gray code as a base 10 number on its own line, with each gray code double-spaced from the next. Explanation:
Nθ Input `N` as a number
Nη Input `k` as a number
θ Input `N`
X To the power of
η Input `k`
E Map over implicit range
ι Current value
÷ Vectorised integer divide
θ Input `N`
X Vectorised to power
… Range from
⁰ Literal integer `0`
η To input `k`
⮌ Reversed
E Map over list
λ Current value
± Negated
⊖ Decremented
⟦ ⟧ List of that and
λ Current value
﹪ Vectorised modulo
θ Input `N`
⊗ Doubled
⌊ Take the minimum
I Cast to string
Implicitly print