  The complex orthogonal and symplectic groups both act on the complete flag
variety with finitely many orbits. We study two families of polynomials
introduced by Wyser and Yong representing the $K$-theory classes of the
closures of these orbits. Our polynomials are analogous to the Grothendieck
polynomials representing $K$-classes of Schubert varieties, and we show that
like Grothendieck polynomials, they are uniquely characterized among all
polynomials representing the relevant classes by a certain stability property.
We show that the same polynomials represent the equivariant $K$-classes of
symmetric and skew-symmetric analogues of Knutson and Miller's matrix Schubert
varieties. We derive explicit expressions for these polynomials in special
cases, including a Pfaffian formula relying on a more general degeneracy locus
formula of Anderson. Finally, we show that taking an appropriate limit of our
representatives recovers the $K$-theoretic Schur $Q$-functions of Ikeda and
Naruse.
