Michael is preparing gift bags for his birthday party. He has 6 bags of candy and 8 funny hats. He wants to prepare as many bags as possible without having any leftovers, and each bag must be the same. What is the maximum number if bags michael can make?