I realized that I was not clear enough about my question. Here is the missing part:

I have unlimited quantity of each item. I would like to fill in the boxes with 40 items and I would like to keep the number of common items in any box to a minimum.

Like, I have 500 different gifts (with unlimited quantity) to choose from and I would like to prepare gift boxes for children and I will put 40 gifts in each of them. I want to keep the boxes that any 2 children gets as different as possible.

I hope I could make it clear.

Edit: And there are a total of 500 boxes / children.