How Will I Know This For Certain?

"How will I know this for certain?" Zechariah asked and God called his question unbelief. Mary asked "How will this be?" and God said she believed. So why was Zechariah’s question not acceptable and Mary’s was?