Let $\tau(n)$ be the divisor function. Let $a$ be either a constant, or a function of $X$ that is slowly varying with $X,$ say $X/\log(X)<a(X)<X \log(X),$ for example. I want to lower bound sums of the following form $$ \sum_{1\leq n\leq X} a^{1-\frac{\tau(n)}{D}},\quad(1) $$ and $$ \sum_{1\leq n\leq X: n\in I} a^{1-\frac{\tau(n)}{D}},\quad(2) $$ where $I$ is an index set of roughly $n/2$ integers. Here, $0<D\leq X$ is also a function of $X$ that is slowly varying with $X.$

We can, of course, factor out an $a$.

I know the divisor function values for the interval $[1,X]$ obeys a kind of arcsine distribution law, and that should help obtain a bound, but I haven't been able to obtain one. Directly applying the AGM (arithmetic-geometric mean inequality) seems to be too weak.

**Edit:** For (1) we can apply the AGM
$$
a X\left( X^{-1} \sum_{1\leq n\leq X} a^{-\tau(n)/D}\right)\geq a X\left( \prod_{1\leq n\leq X} a^{-\tau(n)/D}\right)^{1/X}
$$
which gives
$$
a X\left( a^{-\sum_{1\leq n\leq X} \tau(n)/DX}\right)\approx aX \left( a^{-(X \log X +(2\gamma-1)X+o(\sqrt{X}))/DX}\right)= X a^{1-O(\frac{\log X}{D})}.
$$
As for 2, the question is how to obtain a worst case bound by using the distribution I alluded to in the original question, plus something else(?).