A cellular automaton that is a generalization of the box-ball system with either many kinds of balls or finite carrier capacity is proposed and studied through two discrete integrable systems: nonautonomous discrete KP lattice and nonautonomous discrete two-dimensional Toda lattice. Applying reduction technique and ultradiscretization procedure to these discrete systems, we derive two types of time evolution equations of the proposed cellular automaton, and particular solutions to the ultradiscrete equations.