Determine all positive integers $k$ for which there exist a positive integer $m$ and a set $S$ of positive integers such that any integer $n > m$ can be written as a sum of distinct elements of $S$ in exactly $k$ ways.
1. **Define the Problem and Notation:**
   We need to determine all positive integers \( k \) for which there exist a positive integer \( m \) and a set \( S \) of positive integers such that any integer \( n > m \) can be written as a sum of distinct elements of \( S \) in exactly \( k \) ways. Let \( \text{sum}(T) \) denote the sum of elements of a set \( T \) (if \( T \) is empty, then \( \text{sum}(T) = 0 \)).

2. **Prove that \( k = 2^m \) works:**
   To show that all \( k = 2^m \) work, we take \( S = \{3^1, 3^2, \ldots, 3^m\} \cup \{2^0, 2^1, 2^2, \ldots\} \). For any integer \( z > 3^{m+1000} \), the number \( z - \text{sum}(T) \) can be written using powers of 2 in exactly one way for any subset \( T \) of \( S \). Thus, there are exactly \( 2^m \) ways to write \( z \) in terms of distinct elements in \( S \).

3. **Show that \( k \) must be a power of 2:**
   - **Lemma 1:** If the problem condition holds with \( k \ge 3 \), then \( S = F \cup B \) where \( F \) is a finite set and \( B \) is a majorized infinite set.
     - **Proof:** Suppose for all \( n \ge N \), there are exactly \( k \) ways to write \( n \) in terms of distinct elements of \( S \). Let \( s_i \) be the \( i \)-th smallest element in \( S \). Let \( t \) be the smallest integer such that \( s_t \ge N \). We prove that we can take \( B = \{s_t, s_{t+1}, s_{t+2}, \ldots\} \). Consider any \( i > j \ge t \). The sum \( s_i + s_j \) can be written in exactly \( k \) ways. However, \( s_j \) can be written in exactly \( k \) ways, so all ways to write \( s_i + s_j \) must contain the element \( s_i \). On the other hand, consider the \( k \) ways to write \( s_i \). Suppose there is a way to write \( s_i = s_{i_1} + s_{i_2} + \ldots + s_{i_p} \) where \( i_1 > i_2 > \ldots > i_p \) with \( p \ge 2 \) and all indices are not equal to \( j \). Then, \( s_i + s_j = s_j + s_{i_1} + s_{i_2} + \ldots + s_{i_p} \) is a way to write \( s_i + s_j \) in terms of distinct elements in \( S \) without \( s_i \), a contradiction. Thus, \( s_j \) must appear in any sum representation of \( s_i \) with \( \ge 2 \) elements for all \( t \le j < i \). Hence, \( s_i = s_{i-1} + s_{i-2} + \ldots + s_t + X \) for some \( X \). Note that \( X > 0 \) since we require at least two ways to write \( X \) in terms of distinct elements in \( S \) since \( k \ge 3 \). Thus, \( s_i > s_{i-1} + s_{i-2} + \ldots + s_t \), proving that \( B \) is indeed majorized.

   - **Lemma 2:** Let \( B \) be a majorized infinite set. Then, \( \text{ways}(B, x) \le 1 \) for all \( x \).
     - **Proof:** Let \( B = \{b_1, b_2, b_3, \ldots\} \) where \( b_i < b_{i+1} \) for all \( i \ge 1 \). Clearly, \( \text{ways}(B, x) \le 1 \) for all \( x \le b_1 \). Now, we prove the claim \( \text{ways}(B, x) \le 1 \) by strong induction. Suppose \( x \ge b_1 \). Let \( i \) be the largest integer such that \( x \ge b_i \). \( b_i \) must be included in the sum representation of \( x \), since otherwise \( b_{i-1} + b_{i-2} + \ldots + b_1 < b_i \le x \). Hence, \( \text{ways}(B, x) = \text{ways}(B, x - b_i) \le 1 \) by the induction hypothesis.

   - **Combining Lemmas:**
     Let \( S = F \cup B \) as in our lemma and let \( b_i \) be the \( i \)-th smallest element of \( B \). Consider the infinite binary vector \( V = (v_1, v_2, \ldots) \) where \( v_i = \text{ways}(B, i) \). Denote \( \text{gap}(i) \) as \( b_i - (b_1 + b_2 + \ldots + b_{i-1}) > 0 \) since \( B \) is majorized. Now, we observe that our vector \( V \) takes a special form.

     - **Lemma 3:** Define \( W_n \) as the vector obtained by removing the first \( n \) elements of \( V \). Let \( N \) be a fixed positive integer. Then, for any prefix \( W \) of \( V \), there exists an integer \( N' > N \) such that \( W \) appears as a prefix of \( W_{N'} \).
       - **Proof:** Let \( i \) be the minimum integer such that \( V_i \) contains \( W \) as a prefix. Then, for all \( j \ge i \), \( V_j \) contains \( W \) as a prefix. Choose \( j \) such that the length of \( V_j \) is larger than \( N \). Note that by the recursive definition, \( V_{j+1} \) contains a copy of \( V_j \) as a substring starting from a position larger than \( N \). Thus, we can choose \( N' \) appropriately to remove a prefix from \( V_{j+1} \) (and thus \( V \)) such that the starting position is the starting position of the second copy of \( V_j \) in \( V_{j+1} \).

     - **Lemma 4:** For any integer \( l \), there exists a prefix of \( V \) with length \( \ge l \) such that it can be written as the concatenation of \( W \), \( 1 \), and \( W \) where \( W \) is some binary vector containing \( 2^m - 1 \) ones for some \( m \ge 0 \) (i.e., it is of the form \( (w_1, w_2, \ldots, w_n, 1, w_1, w_2, \ldots, w_n) \) and exactly \( 2^m - 1 \) of the \( w_i \)s are \( 1 \)s).
       - **Proof:** Let \( N > l^{2020} + 2020 \). Consider the sequence \( \text{gap}(N), \text{gap}(N+1), \text{gap}(N+2), \ldots \). Since all the terms are positive integers, there must exist some \( j \ge N \) such that \( \text{gap}(j) \le \text{gap}(j+1) \). Now, we look at vector \( V_{j+1} \). It is the concatenation of \( V_j \), \( \text{gap}(j+1) - 1 \) zeros, a 1 followed by \( V_j \). We focus on the prefix which is the concatenation of \( V_j \) and \( \text{gap}(j+1) - 1 \) zeros, which can be rewritten as the concatenation of \( V_{j-1} \), \( \text{gap}(j) - 1 \) zeros, a 1, \( V_{j-1} \), and \( \text{gap}(j+1) - 1 \) zeros. Since \( \text{gap}(j) \le \text{gap}(j+1) \), choosing \( W \) as the concatenation of \( V_{j-1} \) and \( \text{gap}(j) - 1 \) zeros works, since \( V_{j-1} \) contains exactly \( 2^{j-1} - 1 \) ones as noted before.

     Combining Lemma 3 and Lemma 4, for any \( N \), we can find a substring \( V' \) of our vector \( V \) of the form \( (v_s, v_{s+1}, v_{s+2}, \ldots, v_{s+m-1}, v_{s+m}, v_{s+m+1}, \ldots, v_{s+2m}) \) where \( s > N \) and \( m \ge \text{sum}(F) + 2020 \) such that \( v_i = v_{i+m+1} \) for all \( s \le i \le s+m-1 \), \( v_{s+m} = 1 \), and any substring of length \( m+1 \) in \( V' \) contains exactly \( 2^x \) ones for some integer \( x \) (follows from the fact that the first \( m+1 \) elements contain exactly \( 2^x \) ones and \( v_i = v_{i+m+1} \)).

     In particular, choose \( N \) such that all integers \( \ge N \) can be written as distinct elements of \( S \) in exactly \( k \) ways. Note that \( s+m \ge N \), so \( s+m+i \) has exactly \( k \) sum representations in \( S \) for all \( 0 \le i \le m \). We will count the total number of sum representations of \( s+m \), \( s+m+1 \), \ldots, \( s+2m \) in \( S \) in two ways. Obviously, this sum is equal to \( (m+1)k \).

     On the other hand, let \( G = (\text{ways}(F, m), \text{ways}(F, m-1), \text{ways}(F, m-2), \ldots, \text{ways}(F, 0)) \). Observe that as \( m > \text{sum}(F) \), the sum of elements in \( G \) is exactly \( 2^{|F|} \). Observe that by fixing the elements to use in \( F \), we find that the number of sum representations of \( s+m+i \) in \( S \) is \(\sum_{j=0}^{m} \text{ways}(F, m-j) v_{s+i+j} \). Observe that this is equivalent to the dot product of \( G \) and a substring of length \( m+1 \) of \( V' \). Summing this value over all \( 0 \le i \le m \) and using the fact that \( V' \) is periodic with period \( m+1 \), we obtain
     \[
     \sum_{i=0}^{m} \sum_{j=0}^{m} \text{ways}(F, m-j) v_{s+i+j} = \sum_{j=0}^{m} \text{ways}(F, m-j) \sum_{i=0}^{m} v_{s+i+j} = 2^{|F|} \cdot \sum_{i=0}^{m} v_{s+i} = 2^{|F|+x}.
     \]

     Hence, \( (m+1)k = 2^{|F|+x} \), which means that \( k \) divides a power of 2. Thus, \( k \) must be a power of 2, as desired.

The final answer is \( \boxed{ k = 2^m } \) for all integers \( m \ge 0 \).