Let $X =\{1, 2, ... , 2017\}$. Let $k$ be a positive integer. Given any $r$ such that $1\le  r \le k$, there exist $k$ subsets of $X$ such that the union of any $ r$ of them is equal to $X$ , but the union of any fewer than $r$ of them is not equal to $X$ . Find, with proof, the greatest possible value for $k$.


Let's think step by step and output the final answer within \boxed{}.
user