The Knicks, Mavericks and Jason Kidd are working on a sign-and-trade deal.

Kidd agreed to a deal with New York on Thursday, surprisingly choosing a new team over Dallas.

Negotiations are ongoing.

The most the Knicks can offer Kidd is $9.7 million over three years, by using the so-called mini-midlevel exception.

Kidd changed his mind about re-signing with the Mavericks on Thursday afternoon.

A person familiar with his mind-set said that Kidd “so much wanted to get to New York” and was clearly conflicted about his decision.