How much weight should I gain in pregnancy

Ka

I'm overweight with bmi 29. My doctor told me to not gain anymore than 9kg. I'm in 16th week and have started gain rapidly now. Haven't gain any weight in first trimester but gained 1kg in 2.5 weeks. If that speed maintains I'm going to weigh much more than doctors recommendation. What should I do and how much should I way every week to not gain anymore than 9kg.