Here's a start with inclusion-exclusion.
Let $P_j^0$ be all ball-box arrangements such that the $jth$ box contains exactly $0$ balls, and let $P_j^1$ be similarly those in which the $jth$ box contains exactly 1 ball.
The total number of ball-box arrangements is $K^N$, so the number you are looking for is $K^N - \big| \bigcup\limits_{j=1}^{K} P_j^0 \cup P_j^1 \big|$. Inclusion exclusion is how you'll approach that big union.
You can attack it straight on because the number of ball-box arrangements having $J$ particular boxes empty and disjoint $I$ particular boxes containing exactly one ball is easily calculated. We pick $I$ of our $N$ balls and permute them into the designated boxes, and then accounting for the $J$ boxes that are off limits, we have $N-I$ balls to put into $K - J - I$ boxes.
In other words, if $A_I$ and $A_J$ are disjoint subsets of $[1,\ldots,K]$ with $|A_I| = I$ and $|A_J| = J$, then
$$
\big| \bigcap\limits_{j \in A_J} P_j^0 \cap \bigcap\limits_{i \in A_I} P_i^1 \big| = \frac{N!}{(N-I)!} (K - I - J)^{N-I}
$$
To account for all of the ways to choose $J$ and $I$ such boxes, you have a multiplicative factor of ${{K} \choose {I}} {{K-I} \choose {J}}$
The theorem of inclusion exclusion gives you that
$$
\big| \bigcup\limits_{j=1}^{K} P_j^0 \cup P_j^1 \big| = \sum_{A_I,A_J \subset [1,\ldots,K] \\ A_I \cap A_J = \emptyset} (-1)^{I+J+1} \big| \bigcap\limits_{j \in A_J} P_j^0 \cap \bigcap\limits_{i \in A_I} P_i^1 \big|
$$
so with the above observations you should be all set! (we're summing over all ways to pick two disjoint subsets of the boxes.)
This post on Stirling numbers of the second kind may be helpful, since this application of inclusion-exclusion is just a slightly more complicated version of that one.