An Extension of the Birthday Problem