Step 1: Understand effective population size ($N_e$).
Effective population size ($N_e$) is defined as the size of an idealized population that would experience the same amount of genetic drift or inbreeding as the actual population.
It is usually smaller than the census population size and depends on genetic and demographic factors.
Step 2: Analyze option (A).
The population size required to avoid extinction over a long time period refers to minimum viable population (MVP).
MVP is a conservation planning concept and is not used to calculate $N_e$.
Hence, (A) is incorrect.
Step 3: Analyze option (B).
Carrying capacity ($K$) represents the maximum number of individuals an environment can sustain.
It is an ecological parameter and does not directly determine effective population size.
Hence, (B) is incorrect.
Step 4: Analyze option (C).
The sum of all connected populations represents total metapopulation size.
However, $N_e$ depends on genetic contribution to the next generation, not simply on total numbers.
Hence, (C) is incorrect.
Step 5: Analyze option (D).
Effective population size is strongly influenced by the number of breeding males and females.
For unequal sex ratios:
\[
N_e = \frac{4N_mN_f}{N_m + N_f}
\]
where $N_m$ and $N_f$ are the numbers of breeding males and females.
Hence, (D) is correct.
Step 6: Conclusion.
The parameter used to calculate effective population size is:
\[
\boxed{(D)}
\]