2000 bmw 528i

what makes the engine idle rough and blow smoke out the exhaust at first crank in the morning for about 5 minutes then it clears up and runs fine and temp gauge stays normal