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$ is the input length and the $x_i$ are other quantities associated with the input. What you need to do is bound how big those quantities in terms of $n$ and then substitute those bounds into :$f$, to obtain a function whose only input is $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$ 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 $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$.