m, n = map(int, input().split(" "))
# 一次放一个
def dfs(m, idx, plate):
    if m == 0:
        return 1
    
    ans = 0
    for i, num in enumerate(plate):
        # 上次放置的idx或者往后放置,同时不要重复放置数值类型
        if i >= idx and plate.index(num) == i:
            plate[i] += 1
            ans += dfs(m-1, i, plate)
            plate[i] -= 1
    return ans
plate = [0] * n
print(dfs(m, -1, plate))