Lets say I have N buckets and M marbles.

How can I calculate the maximum number of ways to satisfy different conditions? example:

how many ways can I arrange 6 marbles in 4 buckets such that

1 bucket has 1 marble,
another bucket has 1 marble,
another bucket has 2 marbles,
another bucket has 2 marbles

THe marbles are unique (eg marbles 1 and 2 in bucket 1 is not the same as marbles 1 and 3 in bucket 1 even though its still 2 marble in one bucket either way)

I need a general solution to this for any M and any N and any arrangement.

This is a small peice of a bigger probability problem I am working on. Any help greatly appreciated.