[Question]
  [
Inspired by @emanresu A's [*Is it a fibonacci-like sequence?*](https://codegolf.stackexchange.com/q/242935/9288) Make sure to upvote that challenge as well!
We say a sequence is Fibonacci-like, if, starting from the third term (\$1\$-indexed), each term is the sum of the previous two terms. For example, \$3, 4, 7, 11, 18, 29, 47, 76, 123, 199\cdots\$ is a Fibonacci-like sequence that starts with \$3, 4\$.
Similarly, for any positive integer \$n\$, we say a sequence is \$n\$-bonacci-like, if, starting from the \$n+1\$ term (\$1\$-indexed), each term is the sum of the previous \$n\$ terms. For example, \$2, 4, 5, 11, 20, 36, 67, 123, 226, 416\cdots\$ is a \$3\$-bonacci-like sequence that starts with \$2, 4, 5\$, while \$1, 2, 4, 7, 8, 22, 43, 84, 164, 321\cdots\$ is a \$5\$-bonacci-like sequence that starts with \$1, 2, 4, 7, 8\$.
In particular, constant sequences (sequences where every item are the same) are \$1\$-bonacci-like.
## Task
Given a non-empty list of positive integers, output the smallest \$n\$ such that it could be part of some \$n\$-bonacci-like sequence. You may assume that the input is (non-strictly) increasing.
Note that a list with length \$n\$ is always a part of some \$n\$-bonacci-like sequence.
This is [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'"), so the shortest code in bytes wins.
## Testcases
```
[3] -> 1
[2, 2, 2] -> 1
[1, 2, 2] -> 3
[2, 3, 4, 7] -> 4
[1, 3, 4, 7, 11, 18] -> 2
[1, 1, 1, 1, 1, 1, 6] -> 6
[2, 4, 5, 11, 20, 36, 67, 123, 226, 416] -> 3
[1, 2, 4, 7, 8, 22, 43, 84, 164, 321] -> 5
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10] -> 10
```
  
[Answer]
# [R](https://www.r-project.org/), ~~91~~ ~~78~~ 77 bytes
*Edit: -1 byte thanks to Giuseppe*
```
function(x){while(any((rowSums(matrix(c(0,x),sum(x|1),T))-x)[0:-T]))T=T+1;+T}
```
[Try it online!](https://tio.run/##bZDRisIwEEXf/YqALxlMIZPUbHel@xObN/GhFsXCNoVqaWT127tTakSjEAIz9547k7SD2zauKMsqH/adK09V47iHv/5Q/e544c6ct03/09VHXhentvK85FJ4EMeu5v6CICxA4mEtvxK7AbC5XeBqYa/3XAI0AJuz5Jvh7KGrBBvPWw2fNR1xWrBUsI8gpxF6kwVDKjALNhXZomOCz0TTKGs5ZSlJ4YasY7aiMUpRlaJ5u@j0iGmTbPRSQUxGHTR0aYWBW75yOgw2IeCTOHn/Ljkb/gE "R – Try It Online")
[Answer]
# [Vyxal](https://github.com/Vyxal/Vyxal), ~~14~~ ~~12~~ 10 bytes
```
?lṠṪ?nȯ⁼)ṅ
```
[Try it Online!](https://vyxal.pythonanywhere.com/#WyJBIiwiIiwiP2zhuaDhuao/bsiv4oG8KeG5hSIsIiIsIlszXVxuWzIsIDIsIDJdXG5bMSwgMiwgMl1cblsyLCAzLCA0LCA3XVxuWzEsIDMsIDQsIDcsIDExLCAxOF1cblsxLCAxLCAxLCAxLCAxLCAxLCA2XVxuWzIsIDQsIDUsIDExLCAyMCwgMzYsIDY3LCAxMjMsIDIyNiwgNDE2XVxuWzEsIDIsIDQsIDcsIDgsIDIyLCA0MywgODQsIDE2NCwgMzIxXVxuWzEsIDIsIDMsIDQsIDUsIDYsIDcsIDgsIDksIDEwXSJd)
Man this new "lambda to newline" thing is cool.
*-2 thanks to @emanresuA*
## Explained
```
?lṠṪ?nȯ⁼)ṅ
        )ṅ   # Get the first positive integer n where:
  Ṡ          #   the sums of all
?l           #   overlapping windows of the input of length n
   Ṫ         #   with the tail removed
       ⁼     #   exactly equals
    ?nȯ      #   input[n:]
```
[Answer]
# [MATL](https://github.com/lmendo/MATL), 25 bytes
```
f"G1@&l2&Y+3L)G@QJh)=A?@.
```
[Try it online!](https://tio.run/##XY3BCsIwEETv@YrBQ6EYarKpsR6kFYSCiCB40JaAXkSh3nro38cNTSkIS7Kz@2b2@@w7/8AHfXNGiSGDg38tal0lHSX3pTmldXU5vtPdvqwy7xxuBzQDrs63xkG0JBEqtHpu@TcSucQmLqKS0Cx0Ead/ZaOVyfVIkmKr5U1wEocQscq1ne@NsUVYsWCk4Im2/BjSM2amWDvxW8YUA2qlhBA/ "MATL – Try It Online")
Generalization of the convolution method from my [fibonacci-like sequence answer](https://codegolf.stackexchange.com/a/243026/8774).
---
*Previous*
### [MATL](https://github.com/lmendo/MATL), 30 bytes
```
f"Gn@XH-t:"G@@H+&:)J&)s=-]~?@.
```
[Try it online!](https://tio.run/##XY0/C8IwEMX3fIpHh0KxrflTYy1IMwgtDk4O0hLQRRDUxQ6d/OrxQlMKwpHcu/u9d6/b8HRXPDB0J9QYc1i4e9S8zaXNhipqjGlXcZUc4@Szz@y3NrmzFpcDuhFn63plwXqZwpdvxdLSr1IUKbZhEVQKQUKUYfpXOliJ3Eyk5GTVtPFOSSFSkiqEXu5NsaVfkSCkpInQ9CgpFkzNsXrmd4RxAviaM8Z@ "MATL – Try It Online")
[Answer]
# Python3, 102 bytes:
```
lambda x,c=0:(v(x,c)and c)or(x and f(x,c+1))
v=lambda x,i:len(x)<=i or(sum(x[:i])==x[i]and v(x[1:],i))
```
[Try it online!](https://tio.run/##XZDdboQgEIWv61NMvFnI0o2g61pT@gh9Adc0uIspiX8Ra@zT24ENe9GEEGbOd84A0@/yPQ5pMc17K697p/rmrmBjN5mUZCV4oGq4w42OM9nAHVvXPHJKo1U@cVN2eiAbfZcGkLQ/Pdmq0tRUyq0ytfNhWMXLmhlKdyvjOI6qtIbXD@BRJRi4FUrOIGWQMbgw4FjwwivCK/9W7qXcZ6Dj/HCIBCNyVF2CwDAhsMr4g059kAgjCidjgViBHZ7jlgru0XNA0xCfB88bosnjykmgRMh/Oi6@k0XuwaafxnkBZZeoHWcwYAZoTbfomXyOg2ZgT3bqzEIO1@FAaRm9KNaAhF5NBE0nlPSsui@9qo6BCbAbgDjS1mrMb4nCf2/2Pw)
[Answer]
# [Dyalog APL](https://www.dyalog.com/), ~~15~~ 13 bytes
-2 thanks to @FrownyFrog. (Since the input is non-decreasing, `⍋` can be used instead of `⍳∘≢` to save 2 bytes.)
```
⊃∘⍸⍋(⊃↓⍷+/)¨⊂
```
[Try it online!](https://tio.run/##RUw7CsJAEO09xSsVDWZm1nE9TohEhIBCKluFIJGAYOMRvIHWHmUuEneXgLzizfvMK451tj0V9WGXlXXRNPtyGCpr79Zd7Pq0/mP9bRpF@7D@PV/Ovi/rzqGDhUwqcERgGpkhcFgnJ10gAvmk/9DUdFjFlHOIQkOTBcwKRzouxn8fPDiBdyB1EKYxlDSgqbIB5T8)
Taking the sequence `1 1 2 3 5` as an example:
```
   ⍋(     )¨⊂  For each n from 1 to the length of the sequence,  1           2        ...
      ↓        is the sequence with the first n terms removed    1 2 3 5     2 3 5    ...
       ⍷       a subsequence of
        +/     the sums of each n-sized window in the sequence   1 1 2 3 5   2 3 5 8  ...
     ⊃         at the first position?                            no          yes      ...
⊃∘⍸            What is the first index where this is true?       2
```
[Answer]
# [Factor](https://factorcode.org/) + `lists.lazy math.unicode`, 68 bytes
```
[ 1 lfrom [ dupd clump [ Σ ] map 1 head* tail? ] with lfilter car ]
```
[Try it online!](https://tio.run/##jZG9TsMwFIX3PMVhRSKKf2oCSDAiFhbEVHWwErexcBLjOEKlytPwPrxScBwUOlDEvZOvv3PusbyVhW/d@Pz08Hh/DaM736VGvu/xolyjDHau7a1udqilr9K@0UVbKnTqtVdNobpZAeuU93vrdONxkySHBKEOYBjwV53h4hbkG6axh//BJHhzXIIQkPwXUYTpAv@0OAWLJQbHavKlGZiACDsoA6UCnEziCLPFmcYYeQDAGXIOIjgYJfOaCK@OYBbdRZRcgWTHaeYHZsmQjOsAm61ra6xR9rZEYfrahsPnBzbhK2y4r5Qsz@GlNndh9qZ9FSTaeOVQSIfNOGHp@AU "Factor – Try It Online")
## Explanation
Find the first positive integer whose sums of clumps of the input, sans the last element, is the tail end of the input.
`1 lfrom [ ... ] with lfilter car` Find the first positive integer where...
```
           ! { 2 4 5 11 20 36 67 123 226 416 } 3      (for example)
dupd       ! { 2 4 5 11 20 36 67 123 226 416 } { 2 4 5 11 20 36 67 123 226 416 } 3
clump      ! { 2 4 5 11 20 36 67 123 226 416 } {
                 { 2 4 5 }
                 { 4 5 11 }
                 { 5 11 20 }
                 { 11 20 36 }
                 { 20 36 67 }
                 { 36 67 123 }
                 { 67 123 226 }
                 { 123 226 416 }
             }
[ Σ ] map  ! { 2 4 5 11 20 36 67 123 226 416 } { 11 20 36 67 123 226 416 765 }
1 head*    ! { 2 4 5 11 20 36 67 123 226 416 } { 11 20 36 67 123 226 416 }
tail?      ! t
```
[Answer]
# [Python 3.8 (pre-release)](https://docs.python.org/3.8/), 76 bytes
```
f=lambda n,i=1:i*all(E==sum(n[I:I+i])for I,E in enumerate(n[i:]))or f(n,i+1)
```
[Try it online!](https://tio.run/##XYyxDsIgFEV3v4IR7BukaG1IGDvwDU0HjBBJ4JUgHfx6JHFQm7vdc89Nr/JYUYwp1@pUMPF2NwTBKy790YRAJ6WeW6Q4a6k7vzC3ZqJhIh6JxS3abIpt1MuFsYYcbXLHWU3ZY6GOzj20NHj4ac5wAc6hP4EY/hCHb4adJJp23a0/1/UN "Python 3.8 (pre-release) – Try It Online")
This is a recursive function that increments `i` until the conditions are met with that `i`.
[Answer]
# JavaScript (ES6), ~~65~~ 64 bytes
*Saved 1 byte thanks to @tsh*
```
f=(a,w)=>a.every((v,i)=>s=i<w|s==v&&s+v-~~a[i-w],s=0)?w:f(a,-~w)
```
[Try it online!](https://tio.run/##nZDRCsIgFIbvewqvhpJbU5utyHqQ4YWsLRbRYoYSxF59nRHrYmwQiQi/@J3/w4txxuZNdX@Et/pUdF2psKGeqIOJClc0T4wdrSBaVe39yyrlgsAuXdi2JqtCr6lVMTn6XQlY2HrS5fXN1tciutZnXOJMaPTLIgStVogtRjSnqN/6P5pRJChaU7ShiEFgqZ6n@QQ92lLP0nLCHIqTTzGPwUTCgF6EgxPnkNZM6g8tJrr5YJ72zyEAlsINk3AIzvS3O5mmxWAghzFboGM9/rW4ewM "JavaScript (Node.js) – Try It Online")
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E/wiki/Commands), 12 [bytes](https://github.com/Adriandmen/05AB1E/wiki/Codepage)
```
ā.Δ„üÿ.VO¨Å¿
```
Straight-forward modification of [my 5-bytes inversed approach from the related challenge](https://codegolf.stackexchange.com/a/242947/52210).
[Try it online](https://tio.run/##yy9OTMpM/f//SKPeuSmPGuYd3nN4v16Y/6EVh1sP7f//P9pQx0jHRMdcx0LHCMgw1rEw0TE0M9ExNjKMBQA) or [verify all test cases](https://tio.run/##XY09CsJAEIX7PcUglo/o/rhGCFppm84mWESzkIAYUcFK0EIPINbWHkIQjLWHyEVisgYEmeLNvPnmzTRcx8Us3FCfZmlknHQdThNDnkdDf8QGDcpPZ2oMitfBeV/y/TW7Zw9n7D9v2fH5KHZgFca2cTI3tDJhRMmCRSkjaqXLTeubVsvfA4@all2YIpATFgiUVSqvVUBCoWsd24FzcNfOv9KWVOhUW9GG1NAlKSSE0FBc14nVvVt6UBKuAtcKUvB6KW2AtkgPvD1hHw).
**Explanation:**
```
ā             # Push a list in the range [1, input-length]
 .Δ           # Pop and find the first which is truthy for:
   „üÿ        #  Push string "üÿ", where the `ÿ` is automatically replaced with
              #  the integer using string interpolation
      .V      #  Execute it as 05AB1E code
              #  (`üN` creates all overlapping lists of size `N`)
        O     #  Sum each inner overlapping list
         ¨    #  Remove the last item
          Å¿  #  Check if the (implicit) input-list ends with this sublist
              # (after which the found result is output implicitly)
```
[Answer]
# [Haskell](https://www.haskell.org/), 58 bytes
```
g n(h:t)l|t==init l=n|1>0=g(n+1)t$zipWith(+)t l
f l=g 1l l
```
[Try it online!](https://tio.run/##jVBNi8IwEL3nV8zBQ4td6CQ11oX0b3gQD8JqG4xZcXNa/O/dF2pxtQGFUHhfM33T7X6Oe@f6viWfdZ8hd9dgjPU2kDP@yk1p2szPOQ@zX3te29Bl8xyaOEBviR25/rSzngx9fQs6X6wPNKMDbdSWHrAsKL4nlpMsKFVQVdByar8JBTEA11PD09PT2cgvhrwsMVDDFOdJjJYSqGKd/M1hbx1dAHDXYFjjoyQnE2pcpsfoColyS328z0dDLO6HGSD/g0o8nAJMJZI3gCJFujwkLd5uPSx9qy6sC/GqZ@xU/gE "Haskell – Try It Online")
[Answer]
# [Ruby](https://www.ruby-lang.org/), ~~59~~ 58 bytes
```
->l{1.step.find{|a|l.each_cons(a+1).all?{|*h,g|g==h.sum}}}
```
[Try it online!](https://tio.run/##XVDdasIwFL7vU@RSXYw9Sc06sA58gT1ADCNqa4VYi52D2fTZ62lqYAiHwPd7klxvu7@@yPr52rbAmp@8ZsWpOrTOOMtysy@/95eqmZg3mDJj7WfrZiU9umOWlay5nbuu61erzdeG2VOVN@xs6tZZVxN1z/JfYydWLbaKzbZ6oae0UHetu0gJTeZrApHilAwTIPyDwquCkoSSd88k3vBkKAEEkHqFe@VlpJekr8HEckzwGCskqkMDxzLOESUgw9LxDuOKdJARoC1FBiQegoO3LoNVhHoZMh9ojcc3xRH@Tf8A "Ruby – Try It Online")
### Let's check:
This exploits a couple of ruby-specific shortcuts to achieve the final result.
```
->l{1.step.find{|a|
```
This is easy: starting from 1, repeat until we find the right number.
```
l.each_cons(a+1).all?{|*h,g|
```
Take every possible subarray of length a+1 and check.
```
g==h.sum}}}
```
Is the last element the sum of all other elements?
So, what happens if no match is found?
After the last check, when a+1 is the length of the array, and `each_cons` returns the whole array, we try to get all subarray of length a+2 (length of the whole array plus 1), the list is empty, and that satisfies the `all?` check, so if no answer is found, the answer is the length of the array.
[Answer]
# [Nibbles](http://golfscript.com/nibbles/index.html), 12.5 bytes
```
/|,~==<*~$.`'.`,$>$_+$>@_
```
[Attempt This Online!](https://ato.pxeger.com/run?1=m708LzMpKSe1eMGCpaUlaboWO_VrdOpsbW206lT0EtT1EnRU7FTitVXsHOIh8lBlN3WilaKNdBRMdBRMdRQMDXUUjAx0FIzNdBTMzIF8I2OggBGQZ2JoFqsUC9UEAA) / [All testcases](https://ato.pxeger.com/run?1=RU5BCsJADLz3FXNYELSuTbLGldriT1oKCkLxot6kPsRLD4pv8Cn-xu1WkIEMk5kJub-Oh6Zpd6f-YfPcPC_n_dy_F9e0K4rNtDO2ntg6NaWpZqbcVqPf_-hzk4QRkFCcDIHDKqjIIAL5oP7QkHFYDg5nEIWGFAuYFY403hmaPmzgBN6B1EGYoiWxrDGwBmXjH18)
```
/|,~==<*~$.`'.`,$>$_+$>@_
/|,~                      Find first number n such that
    ==                     equals
      <*~                   take all except the last 
         $                   n items of
          .                  for each row of
           `'                 transpose
             .                 for each i in
              `,                range from 0 to (excluding)
                $                n
                 >              drop the first
                  $              i items of
                   _              input
                    +         sum of
                     $         the row
                      >     drop the first
                       @     n items of
                        _     input
```
[Answer]
# [Japt](https://github.com/ETHproductions/japt), ~~18~~ 16 [bytes](https://en.wikipedia.org/wiki/ISO/IEC_8859-1)
```
@ãX mx ¯J eUtX}a
```
[Try it](https://petershaggynoble.github.io/Japt-Interpreter/?v=1.4.6&code=QONYIG14IK9KIGVVdFh9YQ&input=WzEsIDEsIDIsIDMsIDUsIDhd)
Port of [@lyxal's Vyxal answer.](https://codegolf.stackexchange.com/a/243479/108687)
Explanation:
```
@             }a  # find the first positive integer X where:
 ãX               #   all overlapped sections of length X
    mx            #   sum each
       ¯J         #   remove the last item
          e       #   is this list equal to
           UtX    #   the last X elements of the input list?
```
[Answer]
# [Charcoal](https://github.com/somebody1234/Charcoal), 23 bytes
```
Ｉ⌕Ｅ⊕Ｌθ⬤θ∨‹μι⁼Σ✂θ⁻μιμ¹λ¹
```
[Try it online!](https://tio.run/##PYvBCsIwEER/JccNrIe0ooInEQXBotBj6SGkwQY20Sapvx83Fy87bx6zZtbRvDWV8owuZDjrlOHqwgSd/sAtmGi9DdlOcLfhlWdYpERxIoIFxSOyTQk8Csf2sqyaEvSrh56csXXSubD@BxyqvpOUNZjlsZRhUCgaFFsUexQH5lpaRjZqx6dt1DiWzZd@ "Charcoal – Try It Online") Link is to verbose version of code. Explanation:
```
     θ                  Input array
    Ｌ                   Length
   ⊕                    Incremented
  Ｅ                     Map over implicit range
       θ                Input array
      ⬤                 All elements satisfy
          μ             Current index
         ‹              Is less than
           ι            Outer value
        ∨               Logical Or
               θ        Input array
              ✂     ¹   Every element from
                 μ      Current index
                ⁻       Minus
                  ι     Outer value
                   μ    To current index
             Σ          Take the sum
            ⁼           Equals
                     λ  Current element
 ⌕                      Find first index of
                      ¹ Literal integer `1`
Ｉ                       Cast to string
                        Implicitly print
```
In Charcoal, the `Sum` of an empty list is `None`, so the test for a 0-binacci-like sequence always fails.
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 13 [bytes](https://github.com/DennisMitchell/jelly/wiki/Code-page)
```
+⁹\Ṗ;@ḣʋƑⱮJTḢ
```
**[Try it online!](https://tio.run/##y0rNyan8/1/7UePOmIc7p1k7PNyx@FT3sYmPNq7zCnm4Y9H///@jDXUUjHQUTHQUzHUULIBsEMcYyASKGJoBCWMjw1gA "Jelly – Try It Online")** Or see the [test-suite](https://tio.run/##y0rNyan8/1/7UePOmIc7p1k7PNyx@FT3sYmPNq7zCnm4Y9H/w@2Pmtb8/x8dbRzLpRNtpKMAQiCmIYIJpI11FEx0FMyhElCejoIhkGNoARVFQ2ZQrUCVphCVRgZArWZAGZBOI6AhRkZAnomhGcI@iLEWICkgB6jEAihiaAYkjI0MEcqMYcaawdRbApUZxHLFAgA "Jelly – Try It Online").
### How?
```
+⁹\Ṗ;@ḣʋƑⱮJTḢ - Link: list of integers, A
          J   - range of length of A -> [1,2,3,...,length(A)]
         Ɱ    - map (for L in [1,2,3,...,length(A)]) with:
        Ƒ     -   is A invariant under?:
       ʋ      -     last four links as a dyad - f(A, L)
 ⁹\           -       L-wise overlapping cumulative reduce A with:
+             -         addition
   Ṗ          -       remove the final value
      ḣ       -       head A to index L
    ;@        -       concatenate -> first L terms of A then summed terms
           T  - truthy (1-indexed) indices
            Ḣ - head
```
[Answer]
# [Husk](https://github.com/barbuz/Husk), 13 bytes
```
|L¹V€ṫ¹mhTm∫ṫ
```
[Try it online!](https://tio.run/##RUw5DgIxEPuQi52DIfyBEtFE6VdCqRAdDVvxl@UDafcn5CMhO4qEXNhjezw/7reW6/Jqz/NWrnX5fMu6lTxfcn2vXbfWYpSEyOjoTIMZAsXRHVcgAgW//zBvKg57yhPEYL3JAmaDko3F/T90DyoICjKFMI1QfMC8cgJNKf0A "Husk – Try It Online")
```
          m ṫ  # for each of the tails of the input
           ∫   # get the cumulative sums,
         T     # transpose this list-of-lists,
       mh      # and remove the last element of each;
   V€          # now check if this is one of
     ṫ¹        # the tails of the input
               # (and output the index if it is)
|L¹            # otherwise, output the length of the input
```
[Answer]
# [Wolfram Language (Mathematica)](https://www.wolfram.com/wolframscript/), 42 bytes
```
1//.a_/;MovingMap[Tr,#,a]!=2#~Drop~a:>a+1&
```
[Try it online!](https://tio.run/##RYy7CsJAFET7/IUspHE0ubvrGhXFwlZQtJMgFzGaIg9CtAnJr695EGSa4cxhEi7fz4TL@ME22lryvDnfvc0x@8bp68j57VpAgMPJVormUGR5w@sdT8m150/8LPenIk7Lm5jtor0I3eby4LSpnErVcCqJNl2hsUgoaCwH1lcQgYIB/GMGWWPR7dKHMjCtKxWkNNBkxtvuImghtEKgQUZDSRpX1V@Y3lmB/Nqp7Q8 "Wolfram Language (Mathematica) – Try It Online")
Uses the check from [this answer](https://codegolf.stackexchange.com/a/243005/81203) to the challenge that inspired this one.
[Answer]
# [Pyth](https://github.com/isaacg1/pyth), 11 bytes
```
fqsM.:PQT>Q
```
[Try it online!](https://tio.run/##K6gsyfj/P62w2FfPKiAwxC7w//9oQx0FIx0FEx0Fcx0FCyAbxDEGMoEihmZAwtjIMBYA "Pyth – Try It Online")
### Explanation
```
fqsM.:PQT>QT    # implicitly add T
                # implicitly assign Q = eval(input())
f               # return the first integer which satisfies lambda T
         >QT    # all but the first T elements of Q
 q              # is equal to
  sM            # map to their sums
    .:  T       # all sublists of length T of
      PQ        # all but the last element of Q
```
[Answer]
# [Julia 1.0](http://julialang.org/), 56 bytes
```
\(L,l=[0L])=sum(l)!=L&&1+L[2:end]\(l=[l;[L]];pop!.(l);l)
```
[Try it online!](https://tio.run/##XY9BbsMgEEX3OcUkiwhUGhnsEKeWcwL3BJgFUahERR1kO1Vv7w4QS1XRCPHn/fnA58M7w3@WpScd860qOk3b6fFFPN223X7PXzol3uxw0z1B7BvVad2Ee9ge0NJ4unzcR/BusOAGGK25xfNE6AZwGXaFFqbg3Uxin8EOXi@we1Jk9tt48m5ncwhmnCwxNLMwumH2A1Gm0dBeoE8E37GoUscMvlGCQaxV8j@yTLRkUDE4pU6VDM8OA46C14mIRP6VTEimGJw45glRYIREGhMEhgmBquJyvTS/IV9RR4wCbTV2uMStFDxZj6u1XOPlOnNGa5H/VPwC "Julia 1.0 – Try It Online")
recursive function. At step `n`, `l` stores the `n` first sub-lists of length `length(L)-n` and `L` is the last one. We iterate until `sum(l)==L`
[Answer]
# [Raku](https://raku.org/), 53 bytes
```
{first {none .rotor($^n+1=>-$n).map:{[R-] $_}},1..$_}
```
[Try it online!](https://tio.run/##RYzBCoMwGINfJUgZG9Pi33adG@pD7Do28WBhMKtULyI@u6uKjBwSvoS0lfvquR5wMMjm0Xxc12O0ja3AXdM37sje9kxZHjF74nXZ3sfnI3qBFdMUEufe564cELACWY7RLE0A0zikMg@RCngtgfYgIKFw3dgaQQRKNvCX3sYKl6UXMaSG9lshIYSGIr3fLheJh1ASiQJpBSlob@V6odfNDRTn8w8 "Perl 6 – Try It Online")
* `first { ... }, 1 .. $_` returns the first number from 1 up to the size of the input list for which the brace-delimited anonymous function returns a true result. Within that function, `$^n`/`$n` is the number being tested. `$_` continues to refer to the input parameter to the outer function.
* `.rotor($^n + 1 => -$n)` produces a moving window of size `$n + 1` across the input list. For example, if the input list is `1, 3, 4, 7, 11, 18` and we're testing whether the list is 2-bonacci-like, the rotor method returns a list of the lists `1, 3, 4`, `3, 4, 7`, `4, 7, 11`, and `7, 11, 18`.
* `.map: { [R-] $_ }` reduces each of those lists with the reversed subtraction operator `R-`. (`a R- b` means `b - a`.) Because the regular subtraction operator `-` is left-associative, the reversed subtraction operator is right-associative, and so to continue the above example, it produces the numbers `4 - 3 - 1`, `7 - 4 - 3`, `11 - 7 - 4`, and `18 - 11 - 7`.
* Finally, `none` returns a truthy result if none of the reduced lists has a truthy value; that is, if all of them are zero.
[Answer]
# [C (gcc)](https://gcc.gnu.org/), 123 bytes
The function takes an array of ints for `a` and its length for `z`.
```
B(a,z,M,b,v,t,L)int*a;{int*c,*p;for(M=b=z;--b;M=v?M:b)for(c=a+z,v=0;c-b-a;v|=t)for(t=*--c,p=c-1,L=b;L--;)t-=*p--;return M;}
```
[Try it online!](https://tio.run/##bVJdb4IwFH3nV9y4mIDeLhQdc6t1yZ7lFzgfoLANszED6BIdv93dUqsO1xTae3rOPbcfir0pdTg8uzHuMMIEt1jj3MuLehCLvR4UDtbi9at0I5nInWAsEZHcPkWPiadRJePhDrfSF4olLBbbH1m3C7UcMKZwLRXjOJeJmDMmvJrJwZomZVZvygIi0Rxu8kJ9bNIMplWd5l@37zPnDMVVlZW1xqgW@IzzwvWcvQPUNKDiKqsWywX3lyBb1Ky1s1GD5yBA0P0S4tcQxSOEMcJ9h3hEETgFfNJZ7fSwk5KUd0YZ@JQqJIbOFFDSIKBozMPruozdRFMoIOqEEB7SbxTwa/rI2oRW90B0v2l5jXBOR/aRFXRiOpJ2Z0ZrhNy3H4msJi6q76zUMmn3azRBK9NBu0PSgHGiFwCuluYk8QUNU3igYTj0Otd0zk/MZ9fcaL5EU2i@9I6167Yuif3q9hY9T5zAk9XKWK3I6qgFBpwAa9pN008RegjWcrH616yfUp4Z9NOX4pJ8YUHFmh1cVHWamBfs2iMkhZR/6Y3jNIdf "C (gcc) – Try It Online")
]