a) Let $ x_1, x_2, ..., x_n $ ($ n> 2 $) be negative real numbers and $ x_1 + x_2 + ... + x_n = m. $ 
Determine the maximum value of the sum
$ S = x_1x_2 + x_1x_3 + \dots + x_1x_n + x_2x_3 + x_2x_4 + \dots + x_2x_n + \dots + x_ {n-1} x_n. $

b) Let $ x_1, x_2, ..., x_n $ ($ n> 2 $) be nonnegative natural numbers and $ x_1 + x_2 + ... + x_n = m. $ 
Determine the maximum value of the sum
$ S = x_1x_2 + x_1x_3 + \dots + x_1x_n + x_2x_3 + x_2x_4 + \dots + x_2x_n + \dots + x_ {n-1} x_n. $
### Part (a)

1. **Substitution and Transformation:**
   Let \( x_1, x_2, \ldots, x_n \) be negative real numbers such that \( x_1 + x_2 + \ldots + x_n = m \). Define \( x_i = -y_i \) for \( i = 1, 2, \ldots, n \), where \( y_i \) are positive real numbers. Then:
   \[
   x_1 + x_2 + \ldots + x_n = -(y_1 + y_2 + \ldots + y_n) = m \implies y_1 + y_2 + \ldots + y_n = -m
   \]

2. **Expression for \( S \):**
   The sum \( S \) can be rewritten in terms of \( y_i \):
   \[
   S = x_1x_2 + x_1x_3 + \ldots + x_1x_n + x_2x_3 + x_2x_4 + \ldots + x_{n-1}x_n
   \]
   Substituting \( x_i = -y_i \):
   \[
   S = (-y_1)(-y_2) + (-y_1)(-y_3) + \ldots + (-y_{n-1})(-y_n) = y_1y_2 + y_1y_3 + \ldots + y_{n-1}y_n
   \]

3. **Using Muirhead's Inequality:**
   Consider the sequences \( (a) = (2, 0, 0, \ldots, 0) \) and \( (b) = (1, 1, 0, \ldots, 0) \). Since \( (a) \succ (b) \), by Muirhead's inequality:
   \[
   \sum_{(a)} y_i^2 \geq \sum_{(b)} y_iy_j
   \]
   This implies:
   \[
   (n-1) \sum_{i=1}^n y_i^2 \geq \sum_{1 \leq i < j \leq n} y_i y_j = S
   \]

4. **Maximizing \( S \):**
   Equality in Muirhead's inequality holds when all \( y_i \) are equal. Let \( y_i = Y \) for all \( i \). Then:
   \[
   y_1 + y_2 + \ldots + y_n = nY = -m \implies Y = -\frac{m}{n}
   \]
   Substituting \( Y \) back into \( S \):
   \[
   S = \binom{n}{2} Y^2 = \frac{n(n-1)}{2} \left( \frac{m}{n} \right)^2 = \frac{(n-1)m^2}{2n}
   \]

Therefore, the maximum value of \( S \) is:
\[
\boxed{\frac{(n-1)m^2}{n}}
\]

### Part (b)

1. **Nonnegative Natural Numbers:**
   Let \( x_1, x_2, \ldots, x_n \) be nonnegative natural numbers such that \( x_1 + x_2 + \ldots + x_n = m \).

2. **Expression for \( S \):**
   The sum \( S \) is:
   \[
   S = x_1x_2 + x_1x_3 + \ldots + x_1x_n + x_2x_3 + x_2x_4 + \ldots + x_{n-1}x_n
   \]

3. **Using Muirhead's Inequality:**
   Similar to part (a), consider the sequences \( (a) = (2, 0, 0, \ldots, 0) \) and \( (b) = (1, 1, 0, \ldots, 0) \). Since \( (a) \succ (b) \), by Muirhead's inequality:
   \[
   \sum_{(a)} x_i^2 \geq \sum_{(b)} x_ix_j
   \]
   This implies:
   \[
   (n-1) \sum_{i=1}^n x_i^2 \geq \sum_{1 \leq i < j \leq n} x_i x_j = S
   \]

4. **Maximizing \( S \):**
   Equality in Muirhead's inequality holds when all \( x_i \) are equal. Let \( x_i = X \) for all \( i \). Then:
   \[
   x_1 + x_2 + \ldots + x_n = nX = m \implies X = \frac{m}{n}
   \]
   Substituting \( X \) back into \( S \):
   \[
   S = \binom{n}{2} X^2 = \frac{n(n-1)}{2} \left( \frac{m}{n} \right)^2 = \frac{(n-1)m^2}{2n}
   \]

Therefore, the maximum value of \( S \) is:
\[
\boxed{\frac{(n-1)m^2}{n}}
\]