For anyone to consider taking their time to study your program and suggest how to speed it up I expect they are almost certainly going to want to quickly and easily understand exactly which of all your many subscripts are connected to which of all your many variables.
Consider the first example
x[t_]:=10;
0,0
Is it the x that is double subscripted? Or the t double subscripted, or do x and t each have one subscript? Hopefully it is not the 10 that is subscripted.
Your displayed program is filled with vast numbers of examples exactly like this. Even clicking on "Make your own copy" gives exactly the same subscript issue. And downloading the pdf file gives exactly the same subscript issue.
Is there any way that you might be able to display your entire program in InputForm ? That would remove all the two-dimensional formatting and all the positioning of all your subscripts. That might make it more feasible for someone to understand exactly what your program is doing and even be able to paste that directly into their Mathematica notebook and perform small experiments to see if a change results in a substantial increase in speed.
You write "For large K's and the small values of T/M, my code runs slowly." Can you give us some idea what "large K" is? 10^3? 10^6? 10^12? And exactly the same question for M. Are you doing thousands or millions of Simplify and thousands or millions or even billions of Integrate? Approximately how many of each of those, potentially complicated and slow, operations are you doing?
Thank you