The Mavericks and Dirk Nowitzki have agreed to a two-year, $40 million deal that will keep the veteran big man in Dallas, sources told ESPN.