Complexity of an encoded turing machine
Your question is rather unclear but I think it's something like this:


  I have a Turing machine and I want to figure out if it runs in polynomial time.  That means that its running time must be bounded by a polynomial function of the input's length. I've figured out an expression for its running time but this expression is in terms of, e.g., some of the numbers represented in the input, and not just the input's length.  How do I proceed from here?


So you've computed a running time that's something like $f(n, x_1, x_2, ...)$ where the $n$&nbsp;is the input length and the&nbsp;$x_i$ are other quantities associated with the input.  What you need to do is bound how big those quantities in terms of&nbsp;$n$ and then substitute those bounds into&amp;nbsp:$f$, to obtain a function whose only input is&nbsp;$n$.

For example, your input includes a list of numbers. That list could have as many as roughly $n/2$ entries, since it could be $0\#0\#0\#\ldots$.  If the list has just one entry, that number has roughly $n$&nbsp;bits, so the biggest number in the list could be as big as $2^n$ or so.

In other situations, you might know more about the input.  Perhaps the entries in the list all have to be different.  Then the input can't be $0\#0\#0\#\dots$ and the entries themselves have to get longer than just one bit.  If you had $k$ entries in the list, they'd need about $\log k$ bits each, at a minimum, so you'd have $k\log k\leq n$, which you can try to solve and use.

Then, substitute everything you get into&nbsp;$f$ and see what you get.  For the example you have in your question, it's something like $|m|=\Theta(n)$, $k=\Theta(2^n)$, so $|m|(\log n)(\log k)$ is about $n(\log n)(\log 2^n) = n^2\log n$.