Let A be a set of k ≥ 5 elements of an Abelian group G in which the order of the smallest nonzero subgroup is larger than 2k - 3. Then the number of different elements of G that can be written in the form a + a′, where a, a′ ∈ A, a ≠ a′, is at least 2k - 3, as it has been shown in [Gy. Károlyi, The Erdos-Heilbronn problem in Abelian groups, Israel J. Math. 139 (2004) 349-359]. Here we prove that the bound is attained if and only if the elements of A form an arithmetic progression in G, thus completing the solution of a problem of Erdos and Heilbronn. The proof is based on the so-called 'Combinatorial Nullstellensatz.'