Term ranks and permanents of nonnegative matrices