Arrays in HLSL need to have a length that is static at compile time. So in other words..
// You can do this...
static const uint ArraySize = 5
// Or you can do this...
#define ArraySize 5
// But you can't do this
uint ArraySize = 5;
Usually what you do, is you define the array to some maximum size and then set another variable to a value representing how many values to actually use from the array. Like this:
static const uint MaxValues = 5;
Just be careful...depending on the shader profile you use the compiler's ability to represent loops in shader assembly may be limited.