A coupled K-matrix description of the reactions pi+N -> pi+N, pi+N -> eta+N, gamma+N -> pi+N and gamma+N -> eta+N