I'm using flex-wrap, which gives me output like

In this two-column example the container number 5 in the last row grows.
However, the first containers are usually more important than the last.
So how can I priorise them? I considered flex-direction: row-reverse without success.
It should work also for say, 3 columns and 8 containers, in which case the first two should grow (not the last two). All containers should have the same size in case the number of containers is a integer multiple of the column numbers .
And the code for the example above
div > div {
background-color: #3b3;
flex: 1 1 40%;
}
<div style="display:flex; flex-wrap: wrap; gap: 10px;">
<div>1</div>
<div>2</div>
<div>3</div>
<div>4</div>
<div>5</div>
</div>