Larry David and Bernie Sanders learned on PBS' genealogy series "Finding Your Roots" that the two are distant cousins. Viewers got to watch the big reveal on the premiere of the show's fourth season.

In a clip, host Henry Louis Gates Jr. gives David and Sanders each a book that has photos and information about a cousin.

"I hope it's a good athlete," David says.

Get Breaking News Delivered to Your Inbox

Then when he opens the book and sees a photo of the Vermont senator, he shouts, "What the hell!"

Meanwhile, Sanders opens the book and puts his hand on his head and says, "You're kidding!" before pealing into laughter. "Oh my God! That is unbelievable. It's true?"

David says, "That is amazing. All right, cousin Bernie."

The comedian spilled the beans by accident in June, ahead of the episode, at a panel for "Curb Your Enthusiasm" at the Television Critics Association summer press tour. He said of Sanders, "He's in the line ... like a third cousin, or something."

At the time, David added, "I was very happy about that, I figured there was some connection." David was supposed to keep mum about the revelation, but a reporter probed him about it after seeing a screener for the episode.

"They told me not to say anything, but you're spilling the beans," he said.

David played Sanders on "Saturday Night Live" through the 2015-2016 election cycle and even appeared with Sanders on the show in February 2016.

Sanders did not seem to mind the impersonation, even when David poked fun and claimed, while in character, that Sanders only had one pair of underwear. Sanders reassured CBS News that he has an "ample" underwear supply.

During a televised town hall, when asked if he could do a Larry David impression, Sanders said, "I am Larry David."