The adjoint equation method for constructing first integrals of difference equations