Red, 38 26 37 bytes
Thanks to @9214 for telling me about the loop command for -12 bytes.
+11 bytes to fix invalidities brought out by @Bubbler.
func[a b][x: a loop b - 1[x: a ** x]] Thanks to @9214 for telling me about the loop command for -12 bytes.
+11 bytes to fix invalidities brought out by @Bubbler.
func[a b][x: a loop b - 1[x: a ** x]]