Persons A and B are guaranteed to have at least one friend. If one of these persons is to be depressed after the breakup, at least one of them must have a number of friends between 1 and K. That probability is:
$$P(A)=P(B)=\sum_{i=1}^{K} p(i)$$
The probability of interest to us is
$$P(A\cup B)=P(A)+P(B)-P(A\cap B)=$$
$$2\sum_{i=1}^{K} p(i) - \left(\sum_{i=1}^{K} p(i)\right)^2$$