Let $n,k$ be arbitrary positive integers. We fill the entries of an $n\times k$ array with integers such that all the $n$ rows contain the integers $1,2,\dots,k$ in some order. Add up the numbers in all $k$ columns – let $S$ be the largest of these sums. What is the minimal value of $S$?
1. **Sum of All Entries in the Array:**
   The sum of all the entries in the \( n \times k \) array is given by:
   \[
   n(1 + 2 + \dots + k) = n \cdot \frac{k(k+1)}{2}
   \]
   This is because each row contains the integers \( 1, 2, \dots, k \) in some order, and there are \( n \) such rows.

2. **Average of the Column Sums:**
   The average sum of the \( k \) columns is:
   \[
   \frac{n \cdot \frac{k(k+1)}{2}}{k} = n \cdot \frac{k+1}{2}
   \]
   This is derived by dividing the total sum of all entries by the number of columns \( k \).

3. **Case \( n = 1 \):**
   For \( n = 1 \), each column contains exactly one number from \( 1 \) to \( k \). Therefore, the largest column sum \( S \) is simply \( k \).

4. **Case \( n \ge 2 \):**
   We need to show that the minimal value of \( S \) is:
   \[
   \left\lceil n \cdot \frac{k+1}{2} \right\rceil
   \]
   To do this, we must construct the array such that the largest difference between any two column sums is at most 1.

5. **Construction for \( n = 2 \):**
   Consider the \( 2 \times k \) array:
   \[
   \begin{array}{|c|c|c|c|}
   \hline
   1 & 2 & \dots & k \\
   \hline
   k & k-1 & \dots & 1 \\
   \hline
   \end{array}
   \]
   Here, each column sum is \( k+1 \), which is \( 2 \cdot \frac{k+1}{2} \).

6. **Construction for \( n = 3 \):**
   - **Even \( k = 2m \):**
     \[
     \begin{array}{|c|c|c|c||c|c|c|c|}
     \hline
     1 & 2 & \dots & m & m+1 & m+2 & \dots & 2m \\
     \hline
     m+1 & m+2 & \dots & 2m & 1 & 2 & \dots & m \\
     \hline
     2m & 2m-2 & \dots & 2 & 2m-1 & 2m-3 & \dots & 1 \\
     \hline
     \end{array}
     \]
     Here, the first \( m \) columns have sum \( 3m+2 \), and the next \( m \) columns have sum \( 3m+1 \). The sums are balanced because moving one column to the right changes the sum by \( +1+1-2=0 \).

   - **Odd \( k = 2m-1 \):**
     \[
     \begin{array}{|c|c|c|c||c|c|c|c|}
     \hline
     1 & 2 & \dots & m & m+1 & m+2 & \dots & 2m-1 \\
     \hline
     m & m+1 & \dots & 2m-1 & 1 & 2 & \dots & m-1 \\
     \hline
     2m-1 & 2m-3 & \dots & 1 & 2m-2 & 2m-4 & \dots & 2 \\
     \hline
     \end{array}
     \]
     Here, all column sums are \( 3m \).

7. **General Case for \( n \ge 2 \):**
   By constructing the required tables for \( n = 2 \) and \( n = 3 \), and noting that we can expand these constructions by adding pairs of rows, we can generalize this to any \( n \ge 2 \).

Thus, the minimal value of \( S \) for \( n \ge 2 \) is:
\[
\left\lceil n \cdot \frac{k+1}{2} \right\rceil
\]

The final answer is \( \boxed{ \left\lceil n \cdot \frac{k+1}{2} \right\rceil } \)