#P1025. Partitioning an Integer into K Positive Parts

    ID: 12247 Type: Default 1000ms 256MiB

Partitioning an Integer into K Positive Parts

Partitioning an Integer into K Positive Parts

Given two integers (n) and (k), partition the integer (n) into (k) parts such that each part is greater than 0. The order of parts is not considered; for example, the partitions (1,1,5), (1,5,1), and (5,1,1) are considered identical. You are required to find the number of distinct partitions.

It can be shown that the answer is given by the binomial coefficient (\binom{n-1}{k-1}).

inputFormat

The input consists of a single line containing two space-separated integers (n) and (k), where (n \ge k).

outputFormat

Output a single integer representing the number of distinct partitions of (n) into (k) positive parts. The result is (\binom{n-1}{k-1}).

sample

7 3
15