Consider a discrete probability distribution $P_i$ over $i$ belonging to set of non-negative integers.
The question is which distribution minimises the function $\sum_i P_ii^2$,
such that $\sum_i P_i = 1, P_i \geq 0,$ and $\sum_i P_ii = k,$
where $k$ is a fixed positive real number ?
Remark : It is quite evident for the given objective function that the minimum will correspond to a distribution where all weights $P_i$ will be $0$, except $P_m$ and $P_{m+1}$, where $m= \operatorname{floor}(k).$ However is there a easy formal proof for this ?
What we need to prove is that the resulting has at most a support of size 2. From there it is obvious that the resulting distribution would be as you have already described (because that would have the lowest variance with the fixed mean). [Note that when $k$ is also an integer, then you can put all the probability weight on that integer and get the lowest variance]. To prove that the support has at most two points in it, let's introduce some Lagrange multipliers and use some KKT conditions: \begin{align} L(P, \lambda, \mu, \nu)& = \sum_i P_i i - \lambda(\sum_i P_i -1) + \mu(\sum_i P_i i - k) - \sum_i \nu_iP_i,\nonumber\\ &v_i\geq 0, ~\forall ~i \end{align} Taking the gradient with respect to $P_i$ we get \begin{align} i^2 -\lambda + \mu i = \nu_i. \end{align} Now note that $vi\geq 0$ and due to complementary slackness property, $ \nu_i p_i = 0$, i.e. if $i^2 -\lambda + \mu i = \nu_i>0$, then the $p_i = 0$. Moreover, based on this relationship $poly(i) = i^2 -\lambda + \mu i$ cannot be negative for positive integers. So, the only points where $P_i$ could possibly be non-zero, are the integer roots of $Poly(i) = 0$, where there are at most two of them, which is exactly what we wanted to prove.