Arron Afflalo and Derrick Williams have informed the Knicks that they are opting out of their contracts, a league source said.

Afflalo was set to make $8 million next season and Williams $4.6 million.

advertisement | advertise on newsday

These moves, which were expected, should open roughly $13 million more to use when free agency begins July 1. The Knicks could have around $35 million to spend on free agents, but that depends on other transactions. Their needs in free agency are both backcourt positions.

VoteKnicks 2016-17: Keep 'em or dump 'em?

There’s still a chance that Williams could return. He would fit well in new coach Jeff Hornacek’s up-tempo system. Williams, the No. 2 pick in the 2011 draft, averaged 9.3 points in 80 games last season.

Afflalo, whom the Knicks signed last year to be their starting shooting guard, ended the season as a reserve and wasn’t happy with his role. He averaged 12.8 points.