[Question]
  [
## The Challenge
The challenge is simple: given an input list `a` and another list `b`, repeat `a` until it is longer than `b`.
As an example, call the repeated list `ra`. Then the following condition must hold true: `len(b) < len(ra) <= len(b) + len(a)`. That is, `a` must not be repeated more than is required.
## Sample Python Implementation
```
def repeat(a, b):
    ra = a.copy()
    while len(b) >= len(ra):
        ra += a
    return ra
```
[Try it online!](https://tio.run/##LcxLCoNAEIThtZ6il9OkCCSaJ5iLiIvWdFCQcWgmBE8/UXFXi6/@MMd@8kVKb/2QaVCJTkAtP/PMhCqSYzeF2XGe/fphVBrVu5bpVW3LZIWrPCx0uWj8mieTFGzw0e3F@oQzigZUl7jgihvueDTM6Q8 "Python 3 – Try It Online")
## Examples
```
[1,2,3], [2,4] -> [1,2,3]
[1,2,3], [2,3,4] -> [1,2,3,1,2,3]
[1,2,3], [18,26,43,86] -> [1,2,3,1,2,3]
[2,3,5], [1,2,3,4,5,6,7] -> [2,3,5,2,3,5,2,3,5]
[1,123], [1,12,123,1234] -> [1,123,1,123,1,123]
```
## Scoring
This is [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'"), shortest answer in bytes wins. Have fun!
  
[Answer]
# [Python 3](https://docs.python.org/3/), 29 bytes
```
lambda x,y:len(y)//len(x)*x+x
```
[Try it online!](https://tio.run/##K6gsycjPM/7/PycxNyklUaFCp9IqJzVPo1JTXx9EV2hqVWhX/P8PAA "Python 3 – Try It Online")
[Answer]
# [Husk](https://github.com/barbuz/Husk), 6 bytes
```
*¹→¤÷L
```
[Try it online!](https://tio.run/##yygtzv7/X@vQzkdtkw4tObzd5////9GGOoZGxrEQGsQEYZNYAA "Husk – Try It Online")
```
   ¤     # combin: ¤ f g x y = f (g x) (g y)
     L   #    where g = length
    ÷    #    and f = integer divide
         # so ¤÷L calculates the (integer) ratio of input lengths;
   →     # then increment the result,
 *¹      # and repeat input 1 that many times
```
[Answer]
# [Vyxal](https://github.com/Vyxal/Vyxal) `r`, 7 bytes
```
₅?Lḭ›ẋf
```
[Try it Online!](https://vyxal.pythonanywhere.com/#WyJyIiwiIiwi4oKFP0zhuK3igLrhuotmIiwiIiwiWzIsMyw1XVxuWzEsMiwzLDQsNSw2LDddIl0=)
**How it works:**
```
₅?Lḭ›ẋf    
₅        # Push first list and its length
 ?Lḭ     # Integer-divide by length of second list
    ›    # Increment ^
     ẋ   # Repeat first list that many times
      f  # Flatten into a single list
```
[Answer]
# [APL (Dyalog Unicode)](https://www.dyalog.com/), ~~20~~ 18 bytes
```
{(A×⌈(⍴⍵,1)÷A←⍴⍺)⍴⍺}
```
[Try it online!](https://tio.run/##SyzI0U2pTMzJT///P@lR24RqDcfD0x/1dGg86t3yqHerjqHm4e2OQHEwd5cmhKr9/99QwUjBWCFJwRBImiiYKphxGQLZID4YcsHlLRSMzBRMjBUszLhAIqZgNSAWmATpMoKYY2gEZgKxCQA "APL (Dyalog Unicode) – Try It Online")
Thanks to [Adám](https://codegolf.stackexchange.com/users/43319/ad%c3%a1m) for golfing some bytes and helping me to fix errors in chat.
`⎕←,⍣2⍨'thanks'`
-2 thanks to [AZTECCO](https://codegolf.stackexchange.com/users/84844/aztecco) `⎕←'thanks'`
[Answer]
# [J](http://jsoftware.com/), ~~15~~ 14 bytes
*-1 byte thanks to [Jonah](https://codegolf.stackexchange.com/users/15469/jonah)'s very clever idea!*
```
];@;<.@%&##<@]
```
[Try it online!](https://tio.run/##y/qvpKeepmBrpaCuoKNgoGAFxLp6Cs5BPm7/Y60drG30HFTVlJVtHGL/a3L5OekpxKrUKTvEahkCJbSBMmAxINvOCqTO2kEFqJIrNTkjX8FIwUQhTcEQSBvDBIyxC5miChrChc0UzIFSIJ7pfwA "J – Try It Online")
Takes input as `b f a`, if `f` is the name you assign the verb to.
## Explanation
```
];@;<.@%&##<@]
       %          divide
        &#        the lengths of the lists by each other
    <.@           and floor it;
           <@]    box b
          #       and repeat it that many times
]  ;              prepend b to this boxed array
 ;@               and raze the result, collapsing it into a single list
```
Instead of incrementing the division result, as I did in the first version below, we simply prepend the input list to the resulting tiled box list, which is equivalent.
## Old Answer
```
]$~#@]*1<.@+%&#
```
[Try it online!](https://tio.run/##y/qvpKeepmBrpaCuoKNgoGAFxLp6zkE6Pm7/Y1XqlB1itQxt9By0VdWU/2typSZn5CsYKZgo4ABpQGwIVGAMU2mMSy2aSkMLBSMzBRNjBQszQiqhppoqmCmYY6oESZrCVBoaAZExCJtgMxMojk0liDAlQSWYNEOo/A8A "J – Try It Online")
### Explanation
```
]$~#@]*1<.@+%&#
            %      divide
             &#    the lengths of the lists by each other
       1   +       increment
        <.@        and floor
      *            multiplied by
   #@]             length of a
]$~                and reshape a to be that length
```
Unfortunately, `#` doesn't work here, as it doesn't preserve the order. (`1 1 1 2 2 2 3 3 3 -: 3 # 1 2 3`.)
[Answer]
# Curry, ~~57~~ 42 bytes
This being my first Curry answer, I'm pretty certain its not quite optimal, but as it is our current lang of the month, I figured I'd give at least a half-hearted try at it.
```
l=length
a!b|l a>l b=a|1>0=a++a!drop(l a)b
```
Edit: [Try it online!](https://tio.run/##Sy4tKqrULUjMTi7@/z/HNic1L70kgytRMakmRyHRLkchyTaxxtDOwDZRWztRMaUov0ADKK6Z9D83MTNPwVYh2kjHWMc0VkFRIdpQB8Q20THVMdMx17GI/Q8A)
A bit longer than I'd like, my first idea involved the recursive return being `r(a++a)b`, but I realized that didn't work unless the correct number of repetitions was a power of two.
Edit -15 bytes from some good tips by [WheatWizard](https://codegolf.stackexchange.com/users/56656/wheat-wizard)
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E/wiki/Commands), 6 [bytes](https://github.com/Adriandmen/05AB1E/wiki/Codepage)
```
gIg÷>и
```
Takes the input-lists in the order \$b,a\$.
[Try it online](https://tio.run/##yy9OTMpM/f8/3TP98Ha7Czv@/4820jHWMYnlijbUAbJiAQ) or [verify all test cases](https://tio.run/##yy9OTMpM/V9Waa@k8KhtkoKSfWWCS9H/9OL0w9vtLuz4r/M/OjraSMc4VifaUAdEx@oogAV0TFCFDC10jMx0TIx1LMzQJHTAqnVMdcx0zIFSIJ4pTMrQCIiMQRhiHJARGxsLAA).
**Explanation:**
```
g       # Push the length of the first (implicit) input-list `b`
 Ig     # Push the length of the second input-list `a`
   ÷    # Integer-divide the length by `b` by that of `a`
    >   # Increase it by 1
     и  # Repeat the second (implicit) input-list `a` that many times
        # (after which the result is output implicitly)
```
[Answer]
# Haskell + [hgl](https://gitlab.com/WheatWizard/haskell-golfing-library), 18 bytes
```
m**frt$P1<<fdv.*l
```
Divide the lengths, add 1 and then repeat that many times.
# Reflection
This is kind of long, but also pretty compact. Part of the issue is that variable reuse is always going to be a bit long. We also have to use both `frt` and `fdv` which are unfortunately 3 bytes each. It's totally possible to do this without flipping via `rt` and `dv`
```
m jn$rt<<P1<<dv.*l
```
But that ends up being a byte longer.
It seems mostly like a quirk of the specific problem that flipping is required.
The only real improvement I can see here is to combine some of the glue used to make things more compact.
* `m jn` used in the 19 byte solution could be 1 function. It has a useful type. If it were 3 bytes it would save 1 byte overall
```
mjn$rt<<P1<<dv.*l
```
* `l2 m` is a little more niche but could be added. As a 3 byte prefix it would actually have *costed* a byte here
```
l2m frt$P1<<fdv.*l
```
It could also be an infix, but that also costs a byte.
```
frt**<(P1<<fdv.*l)
```
However in better circumstances it could potentially save a byte.
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 7 bytes
```
ẋɓL:L}‘
```
[Try it online!](https://tio.run/##y0rNyan8///hru6Tk32sfGofNcz4f3i5/tFJD3fO0Iz8/z862lDHSMc4Vkch2kjHJBZEI4sYY4gZWugYmemYGOtYmEFkQIpMwTI6YPU6pjpmOuYwXYZGEF1ABogNwkATAQ "Jelly – Try It Online")
Nothing all too original.
```
ẋ          Repeat a by
 ɓL        the length of b
   :L}     floor divided by the length of a
      ‘    plus 1.
```
[Answer]
# [Perl 5](https://www.perl.org/), 29 bytes
```
sub{(@{$a=shift})x(1+@_/@$a)}
```
[Try it online!](https://tio.run/##fZBNS8MwGMfP5lM8hGgbfET66liJ5i64y261jEaTOtS1thUmpZ@9Jt0ERVgO4f/2uzyNbt@SiRkxdZ9q8OXAStG9bE0/8r0fXMrNtWQlH6eMmLr1SQ725QGGGBUIeYhxAeL2J7Fdgf830Z8VntgGCwxTjCNcpKcJlyYzMQ9iTDDFmwMzd/jrP5J8II59//JZiUwh01xItsmOqazEBTOuk0zxQ9q0211v6PlV2llXLsEewwrlhLJC7xv91Otn57X1Vd1bWT3uKJIzajMK@gOorCjcgVe/erAE72G1htW9l5Fx@gY "Perl 5 – Try It Online")
[Answer]
# [Pyth](https://github.com/isaacg1/pyth), ~~10~~ 9 bytes
```
*h/l.).Ql
```
[Try it online!](https://tio.run/##K6gsyfj/XytDP0dPUy8w5///aCMdYx3TWK5oQx0Qy0THVMdMxzwWAA "Pyth – Try It Online")
```
*h/l.).Ql
   l.).Q    # get the length of the second list
  /     l   # integer divide it by the length of the first list
 h          # increment the result of the division
*           # multiply by the first list (like int * list in Python)
```
[Answer]
# [K (ngn/k)](https://codeberg.org/ngn/k), 18 bytes
```
{(~(#y)<#:)(x,)/x}
```
[Try it online!](https://ngn.codeberg.page/k#eJxtT0FugzAQvPsVK6UHLBksbONQXPUVuSFLQRQSFAopOBIoSt5e7NKEJj3seHZmNCuXydm7eqsRv60S7A0E0+GC0CY5v6TjtUtKCGBQ2/agvG2ZVbUa1Kg6rC9ok3ohMOCKgcDKUb0U+U2GRzOMgUkQHGL5HLFbNKsCIpCwxq4uggXObSGb2ia0xI476fgdNUIU7Y059gmleftR7Nq6DHqT5YdiyPdZsyuCvP2kX6eiN1Xb9JQJ/hrFtCuORWb8uuqNf2pMVft1O4U7hNKQMMI1pIwIDf47zMLS4H8s8hgIY8IkEZzE8r+Y5ZH+VQWJiCTrn6CzyAJdq/0ouNdSO7fzbr+jRt+7lHTR)
Appends copies of `x` until the length is greater than the length of `y`.
* `(cond)(code)/x` set up a while-reduce, beginning with `x`, the input. the "code" part is repeated until the "cond" part returns a non-truthy value
	+ `(~(#y)<#:)` check whether or not the current list is longer than `y`
	+ `(x,)` prepend a copy to the current list
An alternative version, with the same byte count, instead uses the do-reduce overload, swapping `(~(#y)<#:)` for `((-#x)!#y)`.
[Answer]
# [Desmos](https://desmos.com/calculator), ~~55~~ 49 bytes
```
f(a,b)=[lforl=a,i=[0...floor(b.length/a.length)]]
```
[Try It On Desmos!](https://www.desmos.com/calculator/b8wdtegkqi)
[Try It On Desmos! - Prettified](https://www.desmos.com/calculator/bemfawamsu)
~~I had to write `l=a[1...]` instead of just `l=a` because apparently Desmos defaults to recognizing function arguments as numbers, which the list comprehension doesn't like. The workaround is to force Desmos to recognize it as a list by slicing it in such a way that it just returns the entire list, resulting in +6 bytes.~~ 
Apparently the workaround wasn't even necessary because I *think* `a.length` forces Desmos to recognize `a` as a list, rather than a number. Thanks [@att](https://codegolf.stackexchange.com/users/81203/att) for helping me realize this.
[Answer]
# [Factor](https://factorcode.org/) + `sequences.repeating`, ~~45~~ 42 bytes
```
[ length over length tuck /i 1 + * cycle ]
```
[![enter image description here](https://i.stack.imgur.com/eODfW.gif)](https://i.stack.imgur.com/eODfW.gif)
## Explanation
```
          ! { 2 3 5 } { 1 2 3 4 5 6 7 }
length    ! { 2 3 5 } 7
over      ! { 2 3 5 } 7 { 2 3 5 }
length    ! { 2 3 5 } 7 3
tuck      ! { 2 3 5 } 3 7 3
/i        ! { 2 3 5 } 3 2
1         ! { 2 3 5 } 3 2 1
+         ! { 2 3 5 } 3 3
*         ! { 2 3 5 } 9
cycle     ! { 2 3 5 2 3 5 2 3 5 }
```
[Answer]
# [R](https://www.r-project.org), ~~33~~ 31 bytes
```
\(a,b,`-`=length)rep(a,1+-b/-a)
```
[Attempt This Online!](https://ato.pxeger.com/run?1=m72waMGSNAUb3aWlJWm6FvtjNBJ1knQSdBNsc1Lz0ksyNItSC4BChtq6Sfq6iZoQVTfj0zSSNQx1jHSMNXWSNYx0TDQ1udCEjDEFDS10jMx0TIx1LMygUiBlpmApHbAOHVMdMx1zTag1CxZAaAA)
-2 bytes thanks to pajonk.
[Answer]
# JavaScript (ES6), 43 bytes
Expects `(a)(b)`. This code assumes that both lists are filled with positive integers (as allowed by the OP).
```
a=>g=(b,...c)=>c[b.length]?c:g(b,...c,...a)
```
[Try it online!](https://tio.run/##hctNDsIgEIbhvafoEpKRpoViY0I9CGFBkaINKcY2Xh8DNv4sTGfxbd55Rv3Qs7lfb8t@CmcbBxG16JxAPRBCDBadkT3xdnLLRZ3M0a0hjcbRhGkO3hIfHBqQrKAGqjCSNTCFcfG5sizWuvtv6K96G9iQVQs1B0ah5S@/JVNpssxPDBrgcEg2yVzha1V8Ag "JavaScript (Node.js) – Try It Online")
[Answer]
# [Brachylog](https://github.com/JCumin/Brachylog), ~~11~~ 10 bytes
*-1 byte thanks to [Unrelated String](https://codegolf.stackexchange.com/users/85334/unrelated-string) in chat*
```
lᵐ÷<;?tᵗj₍
```
Takes input as a single list containing the two input lists in reverse order. [Try it online!](https://tio.run/##SypKTM6ozMlPN/r/P@fh1gmHt9tY25c83Do961FT7///0dGGOkY6xjomOqY6ZrE6ChBubOx/HwA "Brachylog – Try It Online")
### Explanation
Ports the common strategy of using int-division to calculate the rep-count:
```
lᵐ÷<;?tᵗj₍
lᵐ          Length of each list in the input
  ÷         Int-divide
   <        Next greater integer
    ;?      Pair with input
      tᵗ    Replace the last element with its tail (i.e. the second input list)
        j₍  Repeat the last element a number of times equal to the first element
```
For example, with input `[[1, 2, 3, 4, 5], [8, 9]]`:
```
lᵐ          [5, 2]
  ÷         2
   <        3
    ;?      [3, [[1, 2, 3, 4, 5], [8, 9]]]
      tᵗ    [3, [8, 9]]
        j₍  [8, 9, 8, 9, 8, 9]
```
### Old solution, 11 bytes
Implements the spec pretty directly, using Brachylog's backtracking:
```
hj↙İ.&tl<~l
h            The first of the inputs
 j           Concatenated to itself
  ↙İ         an unspecified number of times
    .        is the output
     &       And
      t      The second of the inputs
       l     Length of ^
        <    is less than a number
         ~l  which is the length of
             the output (implicit)
```
[Answer]
# [Wolfram Language (Mathematica)](https://www.wolfram.com/wolframscript/), 33 bytes
```
Table[##&@@#,Tr[1^#2]/Tr[1^#]+1]&
```
[Try it online!](https://tio.run/##y00syUjNTSzJTE78n2b7PyQxKSc1WllZzcFBWSekKNowTtkoVh/CiNU2jFX7H1CUmVcSraxrlwZUEqtWF5ycmFdXzVVtqGOkY1xbU22kY1Krg8w1RhUwtNAxMtMxMdaxMAMJg@RNQcI6YJU6pjpmOuYQ9YZGYPVAGsQEYZNartr/AA "Wolfram Language (Mathematica) – Try It Online")
[Answer]
# [Mathematica/Wolfram Language](https://wolfram.com/language), (44) 41 Bytes
`PadLeft[#,Ceiling[Tr[1^#2]+1,Tr[1^#]],#]&`
*-3 bytes from alephalpha on something I really should have caught*
I feel like this could still be shorter, but it works as-is. Uses Tr[1^x] as a way of getting Length for cheap, and takes advantage of Ceiling having a two-argument mode. Other than that, it would probably take a full rewrite to improve, since I can't use [LeftCeiling] to shave bytes with the two-argument mode.
[Try It Online!](https://tio.run/##y00syUjNTSzJTE78n2b7PyAxxSc1rSRaWcc5NTMnMy89OqQo2jBO2ShW21AHwoyN1VGOVfufX1pimxZdbahjpGNcq1MNJHVMamO5Aooy80qigZKx/wE)
[Answer]
# [Exceptionally](https://github.com/dloscutoff/Esolangs/tree/master/Exceptionally), ~~25~~ 18 bytes
```
GV}lL}nGVL/nIU*lP/
```
[Attempt This Online!](https://ato.pxeger.com/run?1=m702tSI5taAkMz8vMSencsGCpaUlaboWm9zDanN8avPcw3z08zxDtXIC9CESUPkF26MNdQyNjGO5wDSICcImsRBpAA)
### Explanation
```
' Get an input
G
' Eval it
V
' Store that in ls
} ls
' Get its length
L
' Store that in num
} num
' Get an input
G
' Eval it
V
' Get the length
L
' Divide by num
/ num
' Truncate to integer
I
' Increment
U
' Repeat ls that many times
* ls
' Print
P
' Attempt to divide the list by itself, ending the program
/
```
[Answer]
# [Charcoal](https://github.com/somebody1234/Charcoal), ~~9~~ 8 bytes
```
Ｗ¬›ⅉＬηＩθ
```
[Try it online!](https://tio.run/##S85ILErOT8z5/788IzMnVUHDL79Ew70oNbEktUgjUkNTR8EnNS@9JEMjQxMIFAKKMvNKNJwTi0s0CjU1rf//j4421DE0Mo7VAdMgJgibxMb@1y3LAQA "Charcoal – Try It Online") Link is to verbose version of code. Explanation:
```
Ｗ¬›ⅉＬη
```
Until the number of output lines exceeds the length of the second input...
```
Ｉθ
```
... output each element of the first input on its own line.
[Answer]
# [Ruby](https://www.ruby-lang.org/), 26 bytes
```
->x,y{x*(y.size/x.size+1)}
```
[Attempt This Online!](https://ato.pxeger.com/run?1=bVBLToRAEI3bPkVlNg1MgeEzIzHDuHK2useOQQOxExRCwwQETuKGGL2ER_E0Ng2Oo3HR9arqvapKv5e3orprhtckeK_KxPQ_zG2NTVsbWmMJ_hyf1gqWtt5Pgs-TfRmLUkAAm83l1c4SecpLbXHztNCtxyhvu7oLazTqmaBgboHqrJ_IAjlmXSjhwNNpLt5HKdzaPY6JlskJEtrooMsgdNBj4565cUy4vyj8K7B9dNboueiv_5ON-Yp9dz1c4RrPJqGi8Ciqrbajtkoc0_Edzqv6JzIi3SFEmWXF0f0DtCC_Dxwh6whAXkkTtSQ0OIMggAwugF5HQlA4B7qLeEp1WAKVhYSCzPYPw4Rf)
[Answer]
# TI-Basic, 26 bytes
```
Prompt A,B
ʟA
While dim(Ans)≤dim(ʟB
augment(Ans,ʟA
End
Ans
```
Output is stored in `Ans` and displayed.
[Answer]
# [Julia 1.0](http://julialang.org/), 31 bytes
```
~=length
A%B=repeat(A,~B÷~A+1)
```
[Try it online!](https://tio.run/##yyrNyUw0rPj/v842JzUvvSSDy1HVybYotSA1sUTDUafO6fD2OkdtQ83/XA7FGfnlCtGGOkY6xrEKqgrRRjomsQq2tjAhbAqMUZTo4FJoaKFjZKZjYqxjYYZbOUjEFKIcLGuiY6pjpmMO0QCW1EEikWwxNILaAmSBOCAMdxaYjyBj/wMA "Julia 1.0 – Try It Online")
[Answer]
# APL+WIN, 18 bytes
Prompts for a nested vector comprising of list b followed by list a
```
∊(∊1+⌊÷/⍴¨v)⍴1↓v←⎕
```
[Try it online! Thanks to Dyalog APL Classic](https://tio.run/##SyzI0U2pTMzJT9dNzkksLs5M/v@ob6qvz6O2CcZcQJanP5BlyPWooz3t/6OOLg0gNtR@1NN1eLv@o94th1aUaQIpw0dtk8uA6oDqgYrauf6ncWkYKZhoKmgYKhgpGGtygfnGaCKGFgpGZgomxgoWZqjiCmC1CqYKZgrmQBkQzxQqY2gERMYgDDELyNAEAA "APL (Dyalog Classic) – Try It Online")
[Answer]
# [JavaScript (Node.js)](https://nodejs.org), 61 bytes
```
(a,b)=>Array(~~(b.length/a.length)+1).fill``.map(_=>a).flat()
```
[Try it online!](https://tio.run/##hY3NCoJAEIDvPUXHWZo2dv1JiBV6DpEcTc3YdkUl6OKrb2odpQ4DHzMf39zpSX3RNe2wN/Zauko5IMyZis9dRy8YR8i5Lk093A70BbYTjFeN1lnGH9TCRcU0LTQNwNxpU1jTW11ybWuoIBEo0Utxm0j0U8Z@3b0/hohQhuh7GIVr3hwIFg@XFgYY4nG9KOSnOMHM8yy/3Rs "JavaScript (Node.js) – Try It Online")
Way longer than the other answers but who cares. Should work in the browser too but TIO only supports `Array.flat()` in Node.
[Answer]
# [Perl 6](https://github.com/nxadm/rakudo-pkg), 34 bytes
```
{|@^a xx 1+@^b.elems div@^a.elems}
```
[Try it online!](https://tio.run/##bU7dCoIwFL73Kc5VKJ2CbbqEKHwPmWA0IVCIhFCqZ1/bUWnGLnZ2zvfHd9ePVppuhE0DJ/N6F1UNwwBsW1SXvW5118P19rTodHzMMerrEZo4ZshRJBhzTJMkgIogznLkElOBufRYp84ci@TDDCUeVm7GyW1/t7pH6aYki4LS1lCwO8MMRB4hVhT@C7xKIRl1Uws6d5uERKE3KdV2I7lXdcml@zfVFw "Perl 6 – Try It Online")
[Answer]
# [C (clang)](http://clang.llvm.org/), ~~62~~ 61 bytes
*-1 thanks to @ceilingcat*
```
f(*a,b,c,d){for(;b=++d%c;);for(;d--;)printf("%d ",a[b++%c]);}
```
[Try it online!](https://tio.run/##dY/LCoMwEEX3/YoiCEm9LvLSQvBLbBeZiKXQ2lK6E7/dRlPdiItZ3BPumYnP/cN1t3Fs2cmB4NHwvn19mKUqy5rUW27n2OS55e/Pvfu2LEmbYwJXU5al/srtMD7dvWO8P4TnoxP1teoFJNRgZ0IzkdAht8wJkICC5PawCC9dElKsy01dxrpaBBI0JbUjUBtBJGfIAlrhXESNAqlJuqPRy1azaPQqhoZBgTKKNEgHVu6ITKwJud6zkglO8/@YAZmg3140jD8 "C (clang) – Try It Online") Inputs are list `a`, list `b`, and their respective lengths in that order (as C doesn't store length information in arrays); outputs are sent to stdout.
[Answer]
# [BQN](https://mlochbaum.github.io/BQN/), 17 bytes
```
⊑⥊˜≠∘⊑×1+·⌊∘÷˜´≠¨
```
Anonymous tacit function that takes a single argument, a list containing the two input lists. [Try it at BQN online](https://mlochbaum.github.io/BQN/try.html#code=RyDihpAg4oqR4qWKy5ziiaDiiJjiipHDlzErwrfijIriiJjDt8ucwrTiiaDCqAoKRyDin6gy4oC/MywgMeKAvzLigL8z4oC/NOKAvzXin6kKCg==)
### Explanation
```
⊑⥊˜≠∘⊑×1+·⌊∘÷˜´≠¨
                ≠¨  Length of each list
               ´    Fold that two-integer list on
              ˜     Reversed-order
           ⌊∘÷      Division-and-floor
          ·         Then
        1+          Add 1
       ×            Multiply by
    ≠∘⊑             Length of the first list
 ⥊˜                Reshape to that length
⊑                  The first list
```
[Answer]
# [Pip](https://github.com/dloscutoff/pip), 12 bytes
```
Ty#>b{Yy.a}y
```
[Try It Online!](https://dso.surge.sh/#@WyJwaXAiLCIiLCJUeSM+YntZeS5hfXkiLCIiLCIiLCJcIjFcIlwiMlwiXCIzXCIgXCIxXCJcIjJcIlwiM1wiXCI0XCIiXQ==)
How?
```
Ty#>b{Yy.a}y
T    {    }  - Till
 y#>b        - Length of y greater than length of b(2nd input)
      Y        - Yank (equivalent to (y:a))
       y.a     - y concatenated with a
           y - Return y 
```
]