[Question]
  [
Given a list of integers, output a list where the \$ i \$th element of the list equals the first number in the input list which is \$ \ge i \$, until there are no such numbers.
For example, if the input is:
```
2 3 5 7 11
```
then we "expand" the sequence out to show where the gaps are:
```
_ 2 3 _ 5 _ 7 _ _ __ 11     # input
1     4   6   8 9 10        # gaps
```
Now we fill in the blanks with the next number that is in the sequence in each case:
```
2 2 3 5 5 7 7 11 11 11 11
1     4   6    8  9 10
```
This is the output.
## Test cases
```
[1]               -> [1]
[3]               -> [3, 3, 3]
[1, 2, 3]         -> [1, 2, 3]
[1, 3, 4, 9]      -> [1, 3, 3, 4, 9, 9, 9, 9, 9]
[2, 3, 5, 7, 11]  -> [2, 2, 3, 5, 5, 7, 7, 11, 11, 11, 11]
```
## Rules
* You may assume the input list is non-empty, strictly increasing, and only contains positive integers
* You may use any [standard I/O method](https://codegolf.meta.stackexchange.com/q/2447)
* [Standard loopholes](https://codegolf.meta.stackexchange.com/q/1061) are forbidden
* This is [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'"), so the shortest code in bytes wins!
  
[Answer]
# [R](https://www.r-project.org/), 30 bytes
Or **[R](https://www.r-project.org/)>=4.1, 23 bytes** by replacing the word `function` with a `\`.
```
function(x)rep(x,diff(c(0,x)))
```
[Try it online!](https://tio.run/##K/qfZvs/rTQvuSQzP0@jQrMotUCjQiclMy1NI1nDQKdCU1PzP4hpqKmprIAKdO0Uog1juUCyxthljXUUQAiixlBHwQjIQVYJNgEiDFcD1GCio2AJVwZVYwyXQUYQXUZgOVMdBXMdBUOIQ0G6jCAmg2UgkmB5ZBz7HwA "R – Try It Online")
[Answer]
# [Python 3](https://docs.python.org/3/), 37 bytes (@Jitse)
```
f=lambda l=[],*L:l and[l]*l+f(*L)[l:]
```
[Try it online!](https://tio.run/##JYxBCsMgEEWvMsto/8aaUirkBt5gmIUhSANTI5JNTm@ELj7vvc2v1/k9iu89L5p@65ZIFxbYGJRS2VjF6iNPNhrWID0fjZT2QsxOwH7M4Yk/PWZ8ho3GC284JxKotr2c07hQY/oN "Python 3 – Try It Online")
### Original [Python 3](https://docs.python.org/3/), 38 bytes
```
f=lambda l,*L:(l,)*l+(L and f(*L)[l:])
```
[Try it online!](https://tio.run/##JYxBCsMgEEWvMkvH/o01pUTIDbyBuLCIRJhqCNnk9Fbo4vPe2/zjvvbe7Bhlk/T95EQC7Z0SsJaH8pRapqK05yAu8ij9JKHaKAQTEeycwRN/WixYp83GC28YE6Oj46ztUvNDmMcP "Python 3 – Try It Online")
Takes the splatted input and returns a tuple.
### How?
This is entirely based on the observation that the first original number `k`, say, will occur `k` times in the output. Working back to front we can treat each number `k[n]` as if it were the first and at the next iteration `n-1` replace the `k[n-1]` excess copies of `k[n]` with copies of `k[n-1]`.
[Answer]
# [BQN](https://mlochbaum.github.io/BQN/index.html), 5 bytes
```
+`⁼/⊢
```
[Try it at BQN online REPL](https://mlochbaum.github.io/BQN/try.html#code=RmlsbGludGhlbmV4dCDihpAgK2Digbwv4oqiCkZpbGxpbnRoZW5leHTCqCDin6gg4p+oMeKfqSwg4p+oM+KfqSwg4p+oMSwyLDPin6ksIOKfqDEsMyw0LDnin6ksIOKfqDIsMyw1LDcsMTHin6kg4p+p)
[BQN](https://mlochbaum.github.io/BQN/index.html) has a lovely 'undo' modifier (`⁼`) which calculates the inverse of any function, where this is possible.  
Here we use it with cumulative sum (`+`` ) to get the cumulative differences starting from zero.  
After that we just need to replicate (`/`) the input values (`⊢`) this number of times.
```
   /    # Replicate the elements of
    ⊢   # the right-hand argument
        # by 
  ⁼     # undo the
+`      # cumulative sum of 
        # the right-hand argument
```
[Answer]
# [Ruby](https://www.ruby-lang.org/), 36 bytes
```
->l{x=0;l.flat_map{|a|[a]*(-x+x=a)}}
```
[Try it online!](https://tio.run/##KypNqvyfZvtf1y6nusLWwDpHLy0nsSQ@N7GguiaxJjoxVktDt0K7wjZRs7b2f4FCWnS0sY6pjmVs7H8A "Ruby – Try It Online")
[Answer]
# [Vyxal](https://github.com/Vyxal/Vyxal), 4 bytes
```
ẋ∩vg
```
[Try it Online!](https://vyxal.pythonanywhere.com/#WyIiLCIiLCLhuoviiKl2ZyIsIiIsIlsyLCAzLCA1LCA3XSJd)
```
ẋ    # Repeat the numbers by themselves
     # [[2, 2], [3, 3, 3], [5, 5, 5, 5, 5]]
 ∩   # Transpose
     # [[2, 3, 5], [2, 3, 5], [3, 5], [5], [5]]
  vg # Get the minimum of each
```
[Answer]
# [PARI/GP](https://pari.math.u-bordeaux.fr), 35 bytes
```
a->vector(a[#a],n,[m|m<-a,m>=n][1])
```
[Attempt This Online!](https://ato.pxeger.com/run?1=m728ILEoMz69YMHiNAXbpaUlaboWN5UTde3KUpNL8os0EqOVE2N18nSic2tybXQTdXLtbPNiow1jNaFKwxMLCnIqNRIVdO0UCooy80qATCUQR0khTSNRU1NHIRqoGkgagwhDHQUjHQUY01hHwURHwRLEMwLzTHUUzHUUDA1jYcYvWAChAQ)
```
a->                                   Define a function with argument `a`
   vector(                        )   that returns a vector
          a[#a],                      whose length is the last term of `a`
                n,                    and the `n`th term
                  [m|m<-a,    ][1]    is the first `m` in `a` such that
                          m>=n        `m` is larger than `n`.
```
[Answer]
# [JavaScript (Node.js)](https://nodejs.org), 40 bytes
```
a=>a.map(g=n=>n>o.push(n)&&g(n),o=[])&&o
```
[Try it online!](https://tio.run/##bY3RCsIwDEXf/Yo8jRbqRjtFRNofGX0oc5vKbIpTf792m0rpFpIQ7j3c3MzbDPXj6p5bi@fGt9IbqUx@N4500kplFebuNVyIpVnWhc1QVjrc6Gu0A/ZN3mNHWlJxDXFReoKigCBvErBcB0sGYy9wzkCMepr7lVfwELNjcNQJXv6duBcBYsL2DA4MONe/ADH/m5zZnPx4tP8A "JavaScript (Node.js) – Try It Online")
[Answer]
# [Python 3.8 (pre-release)](https://docs.python.org/3.8/), 43 bytes
```
f=lambda n,i=2:n and[n[0]]+f(n[[i]>n:],i+1)
```
[Try it online!](https://tio.run/##JYcxCsMwDAC/otEmGqo4oa0h/YjQ4BJMBa5iTJa83jV0OO6uXufnsPCorfe8lfR97wkMdZujQbKdjW8iU3bGrPKyKKgT@Z6PBgXUgJkEOQwIZ/w74ILPUeNxxTsSiUSoTe102RXv@w8 "Python 3.8 (pre-release) – Try It Online")
Thanks @dingledooper for -2 bytes.
[Answer]
# [K (ngn/k)](https://codeberg.org/ngn/k), 6 bytes
```
(-':)#
```
[Try it online!](https://ngn.bitbucket.io/k#eJxLs9LQVbfSVObiSlPX0DFUQAVcCjrGGEIahtYKRtYKxppoYsbWCibWCpaacDEjsJiptYK5tYKhoaYmAG7pEFk=)
## Explanation
```
(-':)#
(-':)  deltas
     # replicate
```
[Answer]
# [Factor](https://factorcode.org/), 44 bytes
```
[ dup last iota [ '[ _ > ] find ] with map ]
```
[Try it online!](https://tio.run/##VU1NC4JAFLz7K@bWLTCLqKBrdOkSnRaJx/qkRV233Sch4m/fFEJoDvPBMExJWlofH/fr7XJExd5yjcDvjq3mgNL3aEhecJ5FeueNFZySZEgwYUCK8eeyxaXY/KUMWxyWPHc77JHO0zEqFJ1DTUFgWiEorBSeOCNHaWwxycdM9w055HHmIKSrNXTN5OMX "Factor – Try It Online")
Let \$L\$ be the last element of the input. Then map \$[0..L)\$ to the first element of the input that is greater.
[Answer]
# APL+WIN, 13 bytes
Prompts for input
```
(-2-/0,v)/v←⎕
```
[Try it online! Thanks to Dyalog APL Classic](https://tio.run/##SyzI0U2pTMzJT9dNzkksLs5M/v@ob6qvz6O2CcZcQJanP5BlyPWooz3tv4auka6@gU6Zpn4ZUBAo@R8ozPU/jcuQK43LGIgNFYwUILSxgomCJZAF5CuYKpgrGBoCAA "APL (Dyalog Classic) – Try It Online")
[Answer]
# [Halfwit](https://github.com/chunkybanana/halfwit/), 7.5 bytes
```
MZ;RZMR[$
```
[Try It Online!](https://dso.surge.sh/#@WyJoYWxmd2l0IixudWxsLCJNWjtSWk1SWyQiLCIiLCJbWzJuLCAzbiwgNW4sIDduXV0iLCJjcCJd)
I think I made it too minimalistic...
[![enter image description here](https://i.stack.imgur.com/0d7Zt.png)](https://i.stack.imgur.com/0d7Zt.png)
## Explanation
```
M ;       # Map over each value...
 Z        # Fill an array of length (itself) with (itself)
   R      # Reduce by (taking two lists)
    Z     # Zip
     M    # For each pair...
      R   # Reduce by...
       [  # If the first is truthy (nonzero)...
        $ # return it, otherwise return the other value
```
[Answer]
# [Julia 1.0](http://julialang.org/), 29 bytes
```
!x=[fill.(x,diff([0;x]))...;]
```
[Try it online!](https://tio.run/##yyrNyUw0rPj/X7HCNjotMydHT6NCJyUzLU0j2sC6IlZTU09Pzzr2f0FRZl5JTp6GYrSRjoKxjoKpjoK5joKhYazmfwA "Julia 1.0 – Try It Online")
[Answer]
# [MATL](https://github.com/lmendo/MATL), 6 bytes
```
0yhdY"
```
[Try it online!](https://tio.run/##y00syfmfkKlQEuWnYK9QoacQqxDh8d@gMiMlUul/hItCSOz/aMNYrmhjIDbUUTDSUYCyjHUUTHQULIEcIzDHVEfBXEfBEKjWQN8AAA "MATL – Try It Online")
Take a `diff` and `repelem` the input that many times (same as @pajonk's R answer among others).
I thought this sounded ideal for an `interp1` based answer, but that comes out to 16 bytes: `0ihttX>:IG1)5$Yn` [Try it online!](https://tio.run/##y00syfmfkKlQEuWnYK9QoacQqxDhoVDx38Ajo6Qkws7K08NQ01QlMu9/hItCSOz/aMNYrmhjIDbUUTDSUYCyjHUUTHQULIEcIzDHVEfBXEfBEKjWQN8AAA "MATL – Try It Online")
[Answer]
# [Octave](https://www.gnu.org/software/octave/), 26 bytes
```
@(v)repelem(v,diff([0,v]))
```
[Ideone link](https://ideone.com/GqLzwQ) (TIO's version of Octave doesn't seem to have `repelem`.)
This started off as seeing if I'd have better luck with `interp1` on Octave directly ([than via MATL](https://codegolf.stackexchange.com/a/243815/8774)), but it's again longer here, at 45 bytes:
```
@(v,w=[0,v])interp1(w,w,1:max(v),'next',v(1))
```
[Try it online!](https://tio.run/##y08uSSxL/Z@WmZOTl1pRUqxgqxDz30GjTKfcNtpApyxWMzOvJLWowFCjXKdcx9AqN7FCo0xTRx2kVl2nTMNQU/M/F1yzRrRhrCYy1xiVa6ijYKSjgClorKNgoqNgiSpuBBY31VEw11EwBJn7HwA "Octave – Try It Online")
(the `w=[0,v]` is because `interp1` doesn't like operating on single element vectors like the `[3]` testcase, wants at least two elements.)
[Answer]
# [Pip](https://github.com/dloscutoff/pip), ~~13~~ 11 bytes
*-2 bytes by porting [Neil's Charcoal answer](https://codegolf.stackexchange.com/a/243787/16766) because I was seriously overthinking things*
```
FngT Ui=Pn0
```
Takes input as separate command-line arguments; gives output as lines of stdout. [Attempt This Online!](https://ato.pxeger.com/run?1=m724ILNgwYKlpSVpuhar3fLSQxRCM20D8gwgIlCJDdFGOgrGOgqmOgrmOgqGhrFQcQA)
### Explanation
```
FngT Ui=Pn0
             ; i is 0, g is list of command-line args (implicit)
Fng          ; For each n in g:
   T         ;   Till
     Ui      ;   increment i
       =     ;   equals
        Pn   ;   print n:
          0  ;     No-op
```
[Answer]
# [Desmos](https://desmos.com/calculator), 45 bytes
```
M=l.max
f(l)=[\{l<i:M,l\}.\min\for i=[1...M]]
```
[Try It On Desmos!](https://www.desmos.com/calculator/xpirriwtpc)
[Try It On Desmos! - Prettified](https://www.desmos.com/calculator/1rndfqr9ze)
I feel like this could be a bit shorter, though I don't see it at the moment. I tried to take out the two uses of `l.max` but the strategies I tried didn't work. Also that piecewise expression is a bit annoying, though I don't see a shorter way (it causes me to add `\`'s everywhere in the list comprehension. Without the `\`'s the code won't work.).
[Answer]
# [HBL](https://github.com/dloscutoff/hbl), 9 bytes
```
-(2*(<1.?)(2-.(10.
```
The online interpreter doesn't support `zip-with` yet, but here's a version with a hacked-together reimplementation of `zip-with` on the first line: [Try it!](https://dloscutoff.github.io/hbl/?f=0&p=PCcoLCgxLikoJzEuKSkoMiwnLCkuCi0oKCkqKDwxLj8pKCgpLS4oMTAu&a=KDEgMiA1IDkp)
### Explanation
```
-(2*(<1.?)(2-.(10.
          (2       )   Zip
            -          with the subtraction function:
             .          The input list, and
              (1  )     Cons
                0        0 to
                 .       the input list
                       Result: pairwise differences
    (<   )             For each item in
       .               the input list:
      1                 cons it to
        ?               nil
                       Result: input list but with each number in a singleton list
 (2                 )  Zip those two lists
   *                   with the list-repetition function
                       Result: for each n in the input list, a length-n list of n's
-                      Flatten
```
[Answer]
# [Haskell](https://www.haskell.org/), ~~37~~ 34 bytes
```
f l=do(a,b)<-zip(0:l)l;b<$[a+1..b]
```
[Try it online!](https://tio.run/##bY7BDoIwEETvfsUcOEBciG01RgV/hPRQgkRCBaKe/PnatJG06mb3sG8yO3tVj@GitTEddNVOqaImK/NXP6ebo870qSmTWq1ZUTTS3FQ/okI7YYX53o9PJOhQMxmtIl4ZgRN@oSBsCYeYc8d3hD2BMWnsbcSVn12gTfkjCGe3WUtq7Pu8EuZHslh42Nbw9Zg3cH/PcS85NRz5Bg "Haskell – Try It Online")
* Saved 3 Bytes thanks to @Unrelated String suggesting using do notation which reveals how emphatic Haskell is.
[Old version](https://tio.run/##bY7BDoIwEETvfsUcONC4EEs1RkP5EeyhjRKJFYl68udrUyJp1c3uYd9kdvasH5eTtc51sDI/5JoMKxpTZ61e8rI0ism6fvVjvtpbZt1V9wMkjjcsMN774YkMHVquklWkKydUhF8oCGvCLuVV4BvClsC5cv420iqaEOhT/ggi2H3WnJr6Pq/E@YksZh63N3w9Nhmq6V7gkxTUeNQb "Haskell – Try It Online") 
```
f l=(\(a,b)->b<$[a+1..b])=<<zip(0:l)l
```
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 4 [bytes](https://github.com/DennisMitchell/jelly/wiki/Code-page)
```
xŻI$
```
A monadic Link that accepts a strictly increasing list of positive integers and yields a non-strictly increasing list of positive integers.
**[Try it online!](https://tio.run/##y0rNyan8/7/i6G5Plf9H9xxuf9S05uikhztnAGkgcv//PzraMJZLJ9oYRBjqKBjpKMCYxjoKJjoKliCeEZhnqqNgrqNgCFQfCwA "Jelly – Try It Online")**
### How?
If the input is `A=[a1, a2, a3, ...]` then the output needs to be `a1` `a1`s followed by `a2-a1` `a2`s then `a3-a2` `a2s` etc.
```
xŻI$ - Link: strictly increasing list of positive integers, A
   $ - last two links as a monad - f(A=[a1, a2, a3, ...]):
 Ż   -   prepend a zero -> [0, a1, a2, a3, ...]
  I  -   incremental differences -> [a1, a2-a1, a3-a2, ...]
x    - times (vectorises) -> [a1, ..., a1, a2, ..., a2, a3, ...]
```
[Answer]
# [Perl 5](https://www.perl.org/), 39 bytes
```
sub{$l=0;map{($_)x($l+=$r=$_-$l,$r)}@_}
```
[Try it online!](https://tio.run/##bVBda4MwFH3PrziEdCqLsMS60ko23wfry946kX3oKLPq1EKH9Le7RNtqYeEm3HvOuecmKZMq8zuWqq7ev7csU3fB7q1sbRY7B5tlt4pVisUuyzirnGMYH7uApEVlkw2wERGul3oYwIj3vPcf73GYGFWCQw7A1OUCjirdNudYRlcq74JPY@yTPe9zLDiEuZvpk4N7jw9Uz0734OC0xMza/dpsm5ecJYfSUSGLgxOM8KtooHDDUjs0EmdgymqbNymdufc1oOF9s8LMFVJX0B7JR5N8GkQaHtpDF/VrTjk5fwINzTCK5EenWkDxCKv4trCC9bx@wfrJ4kakzSk/q/lJG5BjJ4hHBCTM6WGOJdE5fCz04/4A "Perl 5 – Try It Online")
[Answer]
# [R](https://www.r-project.org/), 41 bytes
```
function(x)x[cumsum(y<-1:rev(x)%in%x)+!y]
```
[Try it online!](https://tio.run/##K/qfpmCj@z@tNC@5JDM/T6NCsyI6uTS3uDRXo9JG19CqKLUMKKaamadaoamtWBn7P00jWcNQU5MLRBtDaUMdIx0E21jHRMcSygOK65jqmOsYArX8BwA "R – Try It Online")
Quite a lot longer than [pajonk's answer](https://codegolf.stackexchange.com/a/243767/67312), but a nice little bit of index calculation all the same.
This ports to other matrix languages such as, for instance, [MATL](https://tio.run/##y00syfn/vyTAyj23pK48slhb8///aCMFYwVTBXMFQ8NYAA), but it's longer than the `diff` approach there as well.
[Answer]
# [Arturo](https://arturo-lang.io), 42 bytes
```
$[a][map 1..max a'x[min select a'y[y>=x]]]
```
[Try it](http://arturo-lang.io/playground?2ytyWY)
```
$[a][                 ; a function taking an argument a
  map 1..max a'x[     ; map over the range 1..max(a) and assign current value to x
    min select a'y[   ; select the smallest number in a that...
      y>=x            ; is greater than or equal to x
    ]                 ; end select
  ]                   ; end map
]                     ; end function
```
[Answer]
# [JavaScript (Node.js)](https://nodejs.org), 38 bytes
```
a=>a.map(g=n=>n>++i?[n,g(n)]:n,i=0)+''
```
[Try it online!](https://tio.run/##bY3LDoIwEEX3fsXsaMMIFjRGTeuHkC4aBILBKRHj71ceahpgMrO59@TM3bxNlz/r9rUleytcKZ2RykQP07JKklSkwrC@ZoQVI67PhLXc8TAIXG6ps00RNbZiJcuEBn84v0AcQx9vZmC6DqYIwy5wgZAM@dz7jVfwXrNHOOkZnv4bfxeCZMQOCEcEIfRPkEz/xmYqx94/7T4 "JavaScript (Node.js) – Try It Online")
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 4 bytes
```
x)o/
```
[Try it online!](https://tio.run/##y0rNyan8/79CM1///@F2b83I//@jDWN1FKKNQYShjpEOlGGsY6JjCWICRXRMdcx1DA1jAQ "Jelly – Try It Online")
Shamelessly sandbox sniped, [but I didn't start it :P](https://chat.stackexchange.com/transcript/240?m=60581858#60581858)
```
 )      For each element of the input, as a monadic chain:
x       repeat it by itself.
  o/    Reduce the resulting list of lists by logical OR.
```
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E/wiki/Commands), ~~8~~ ~~7~~ 6 [bytes](https://github.com/Adriandmen/05AB1E/wiki/Codepage)
```
Å1*ζ€ß
```
-1 byte porting [*@emanresuA*'s Vyxal answer](https://codegolf.stackexchange.com/a/243766/52210)
[Try it online](https://tio.run/##yy9OTMpM/f//cKuh1rltj5rWHJ7//3@0kY6xjqmOuY6hYSwA) or [verify all test cases](https://tio.run/##yy9OTMpM/V9Waa@k8KhtkoKSfaXL/8Othlrntj1qWnN4/n@d/9HRhrE60cZAbKhjpAOhjXVMdCyBLCBfx1THXMfQMDYWAA).
**Original ~~8~~ 7 [bytes](https://github.com/Adriandmen/05AB1E/wiki/Codepage) answer:**
```
0š¥Å1*˜
```
[Try it online](https://tio.run/##yy9OTMpM/f/f4OjCQ0sPtxpqnZ7z/3@0kY6xjqmOuY6hYSwA) or [verify all test cases](https://tio.run/##yy9OTMpM/V9Waa@k8KhtkoKSfaXLf4OjCw8tPdxqqHV6zn@d/9HRhrE60cZAbKhjpAOhjXVMdCyBLCBfx1THXMfQMDYWAA).
**Explanation:**
```
         #  e.g. input=[2,3,5]
Å1       # Map each value in the (implicit) input-list to that many 1s
         #  → [[1,1],[1,1,1],[1,1,1,1,1]]
 *       # Multiply each to the (implicit) input-list at the same positions
         #  → [[2,2],[3,3,3],[5,5,5,5,5]]
  ζ      # Zip/transpose; swapping rows/columns, using " " as filler
         #  → [[2,3,5],[2,3,5],[" ",3,5],[" "," ",5],[" "," ",5]]
   €ß    # Get the minimum of each inner list, ignoring the " "
         #  → [2,2,3,5,5]
         # (after which the resulting list is output implicitly)
0š       # Prepend a 0 to the (implicit) input-list
         #  → [0,2,3,5]
  ¥      # Pop and push its deltas/forward-differences
         #  → [2,1,2]
   Å1*   # Similar as above
         #  → [[2,2],[3],[5,5]]
      ˜  # Flatten this list of lists
         #  → [2,2,3,5,5]
         # (after which the resulting list is output implicitly)
```
[Answer]
# [Python 3.8 (pre-release)](https://docs.python.org/3.8/), 75 bytes
```
def f(a):
 s=[i:=(c:=a[-1])]
 while i:=i-1:s=[c:=[c,i][i in a]]+s
 print(s)
```
[Try it online!](https://tio.run/##XY/BasMwDIbvfoqfnBKmQJ1sbDO4t73A2M3oEFKHGkoa4pS2T5/ZbpqWgmys//slS8N12h/7@msY53lnO3R5UygBr41TOm@VbkwpuWCB894dLILqSqkCD8y05Ng4uB4N85sXGEbXT7kv5rbx1kPDCBgjmRAuppjUMakJMRZJEqqYRdfyXEGwvRO@F1avwnMs7irBD8InQaY/q1u3JN70hJ5PrGUhuuOIOHPcJc2u7stkf9ZPKqMkmw0XK0C5xc9lsO0Dyxf8a/3pkLDtdzpDFnCX3zvN/w "Python 3.8 (pre-release) – Try It Online")
Ungolfed:
```
def fill_numbers(original):
    current_number = last_valid = original[-1]
    result = [original[-1]]
    while current_number-1 > 0:
        current_number -= 1
        if current_number in original:
            last_valid = current_number
        result = [last_valid] + result
    print(result)
```
[Answer]
# [Pyth](https://github.com/isaacg1/pyth), 9 bytes
```
hM.Tm*d]d
```
[Try it online!](https://tio.run/##K6gsyfj/P8NXLyRXKyU25f//aCMdBWMdBdNYAA "Pyth – Try It Online")
[Answer]
# [Charcoal](https://github.com/somebody1234/Charcoal), 9 bytes
```
ＦＡＷ‹ⅉι⟦Ｉι
```
[Try it online!](https://tio.run/##S85ILErOT8z5/z8tv0hBwzOvoLREQ1NToTwjMydVQcMntbhYI1JDU0chEygYUJSZV6IR7ZxYXKKRqRmraf3/f3S0kY6CsY6CqY6CuY6CoWFs7H/dshwA "Charcoal – Try It Online") Link is to verbose version of code. Explanation:
```
ＦＡ
```
Loop over the input list.
```
Ｗ‹ⅉι
```
Repeat until the appropriate line is reached...
```
⟦Ｉι
```
... output the current value on its own line.
[Answer]
# PHP, 71 bytes
```
$n=[];for($i=max($a);$i;$i--){$n=[in_array($i,$a)?$h=$i:$h??$i,...$n];}
```
[Try it online!](https://tio.run/##FYpRCsIwEESvsh8LTWAbqCJaY8hBSigLVRKw6RJQFPHsMcLMx7w3EqVevEQBZHAw7Qj2BEeCE8FIMLQ9HFrHYCtmNwV724rC5FZ@KWRtMbX0vf78bcozl8LvdqAmPUaH6YzR@waMMZiD/dYnl3l5rKLSKvdtuaqOOgLMWtv6Aw "PHP – Try It Online")
Ungolfed:
```
$n = [];
for ($i = max($a); $i; $i--) {
  $n = [in_array($i, $a) ? $h = $i : $h ?? $i, ...$n];
}
```
]