If $\kappa$ is not inaccessible, then it is either singular or not a strong limit. Then you can describe it letting $A$ encode an ordinal $\alpha$ and a cofinal map from $\alpha\to\kappa$ in the first case, or $P(S)$ for some $S\in V_\kappa$ and a surjective map $P(S)\to \kappa,$ in the second case. We can write a sentence that says something like "the ordinal exists and is the domain of the map" for the singular case and observe this sentence must fail when we restrict to any smaller $V_\lambda.$ This is a first order sentence, so certainly $\Sigma_1^1.$
Conversely, if $\kappa$ is inaccessible, and $(V_\kappa,\in, A)\models\exists X\varphi(X),$ let $X\subseteq V_\kappa$ be a witness. We can construct an elementary submodel $(V_\lambda,\in, A\cap V_\lambda, X\cap V_\lambda)\prec (V_\kappa,\in, A, X)$ for some $\lambda<\kappa$ in the same manner in which the reflection theorem is proved.