We construct the Schubert basis of the torus-equivariant K-homology of the affine Grassmannian of a simple algebraic group G, using the K-theoretic NilHecke ring of Kostant and Kumar. This is the K-theoretic analogue of a construction of Peterson in equivariant homology. For the case where G=SLn, the K-homology of the affine Grassmannian is identified with a sub-Hopf algebra of the ring of symmetric functions. The Schubert basis is represented by inhomogeneous symmetric functions, calledK-k-Schur functions, whose highest-degree term is a k-Schur function. The dual basis in K-cohomology is given by the affine stable Grothendieck polynomials, verifying a conjecture of Lam. In addition, we give a Pieri rule in K-homology. Many of our constructions have geometric interpretations by means of Kashiwara’s thick affine flag manifold.