A subset $B$ of \( \{1, 2, \dots, 2017\} \) is said to have property \( T \) if any three elements of \( B \) are the sides of a nondegenerate triangle. Find the maximum number of elements that a set with property \( T \) may contain.

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