The tower function of twos is defined recursively as follows: $T(1)=2$ and $T(n+1)=2^{T(n)}$ for $n\ge1$. Let $A=(T(2009))^{T(2009)}$ and $B=(T(2009))^A$. What is the largest integer $k$ such that $\underbrace{\log_2\log_2\log_2\cdots\log_2}_{k\text{ times}}B$ is defined?