Sharp conditions for existence of nontrivial invariant cones of nonnegative initial values of difference equations