Unpacked array to packed

Hello is there a way I can pack all the elements of an Unpacked array into one packed array.
I have an Unpacked array
Rand int unsigned a1 ;
For which I am randomly generating the size using another randomly generated number say t,
Rand int t;

After randomly giving the size to the Unpacked dimension
My motive is to assign all the elements of this randomly generated Unpacked array to one packed array of type bit say
Rand bit [2000:0] a2;

How can I achieve this an int type dynamically generated Unpacked array elements to one packed array…
Thanks

In reply to Ayush_1:

You can use the streaming pack operator (Section 11.4.14 of the 1800-2017 LRM)

a2 = {>>{a1}};

This works as long as the total number of bits in a2 is large enough to hold all the bits in a1. Also note that if a1 has a smaller number of bits, they are left justified in a2.