2 Samuel 24:9-11
English Standard Version
10But David 's heart struck him after he had numbered the people. And David said to the Lord, "I have sinned greatly in what I have done. But now, O Lord, please take away the iniquity of your servant, for I have done very foolishly."
11And when David arose in the morning, the word of the Lord came to the prophet Gad, David 's seer, saying,