#K4816. Flower Bed Distribution

    ID: 28359 Type: Default 1000ms 256MiB

Flower Bed Distribution

Flower Bed Distribution

You are given two positive integers (m) and (n), where (m) represents the number of flower beds and (n) represents the total number of identical flowers. Your task is to determine the number of distinct ways to distribute all (n) flowers among the (m) flower beds such that each flower bed receives at least one flower. This is a classic combinatorial problem which can be solved using the stars and bars method. Mathematically, the answer is given by the binomial coefficient (\binom{n-1}{m-1}).

For example, if there are 4 flower beds and 10 flowers, the answer is (\binom{9}{3} = 84).

inputFormat

The input consists of a single line containing two space-separated integers (m) and (n) (with (1 \leq m \leq n)). (m) is the number of flower beds and (n) is the total number of flowers.

outputFormat

Output a single integer representing the number of ways to distribute the flowers among the flower beds so that each bed has at least one flower.## sample

4 10
84