Maximum number of distinct substrings Description
Given a length n, and an alphabet size k&gt;0, your program must determine the number of strings with those parameters which have a maximal number of unique substrings. In the case of k=2, this generates OEIS A134457.
Example
For example, 2210 has the substrings   , 2, 22, 221, 2210, 2, 21, 210, 1, 10, and 0, for a total of 11. However, 2 appears twice, so it only has 10 unique substrings.
This is as many as possible for a length 4 string containing 3 different symbols, but it ties with 35 other strings for a total of 36 tieing strings including 0012, 2101, and 0121. Therefore, for n=4 and k=3, your program should output 36.
Test Cases
n    k    output

0    5    1
1    3    3
5    1    1
9    2    40
2    3    6
5    5    120
Pyth, 12 bytes
l.Ml{.:Z)^UE

Try it online.
Pure brute force.
Explanation

Implicit: append Q to the program.
Implicit: read and evaluate a line of input (n) in Q.
E: read and evaluate a line of input (k).
U: get a range [0, ..., k-1].
^: get all n-length strings of [0, ..., k-1].
.M: find the ones that give a maximum for function f(Z):

.:Z: find the substrings of Z
{: remove duplicates
l: get the number of unique substrings


l: get the number of such strings