Let \(n=2(p^m-1)/(p-1)\) , where p is an odd prime and \(m>1\) is a positive integer. In this paper, we research optimal p-ary constacyclic codes with two zeros. Two classes of optimal p-ary \([n,n-2m,4]\) constacyclic codes are presented by searching the solutions of certain congruence equations over \(\mathbb {F}_{p^m}\) . Four explicit constructions of optimal constacyclic codes with such parameters are provided. The dual codes of a subclass of these constacyclic codes are also investigated.