Coefficients of \v{S}apovalov elements for simple Lie algebras and contragredient Lie superalgebras