Reverse-Engineer the N-Bonacci sequence[s] EDIT: I will be accepting an answer Monday, 2/15/2016. May the bytes be ever in your favor!

In his "Print the N-Bonacci Sequence" challenge, @DJMcGoathem describes the N-bonacci sequences, wherein the previous N numbers are summed, instead of the traditional 2 of the Fibonacci sequence (said to be the "duonacci sequence"). He then asked to take two inputs, X and N, then output the Xth N-nacci number.

I propose the opposite.
Given a sequence, output which N-nacci sequence it is a subset of. I say "subset of" because:


A) these sequences are infinite
B) if given the start of the sequence, you could just count the number of leading 1s


In the case that it could belong to multiple N-nacci sequences, chose the lowest one.
In the case that it does not belong to any N-nacci sequence, then your program may do anything other than print something that could be mistaken for output. These behaviors include (but are not limited to): infinite loop, error, crash, delete itself (*cough cough* vigil *cough cough*), or create a black hole (as long as this black hole does not produce anything that could be mistaken for valid output).
For the sake of this challenge, these sequences start with 1. This means any N-nacci sequence starts with N ones. Furthermore, N must be a positive integer. So no -1-nacci, etc.

Test cases:

1,1,1 -&gt; 1
49, 97 -&gt; 7
55, 89, 144 -&gt; 2
1 -&gt; 1
6765 -&gt; 2
12, 23, 45, 89 -&gt; 12
100, 199 -&gt; 100
Ruby, 94
I'm quite surprised how far I've been able to golf this within the same algorithm!  I started with over 200!
-&gt;a{1.step.find{|s|x=[1]*(s+z=a.size)
x&lt;&lt;x[-s,s].inject(:+)while x.max&lt;a.max&amp;&amp;s&gt;1
x[-z,z]==a}}

Ungolfed:
l=-&gt;a{
    # ooh! a built-in infinite incrementer!
    1.step.find{|s|
        # if n == 1, z is important, otherwise s.
        x=[1]*(s+z=a.size)
        ## add the next nacci number until we hit or overshot max. 
        ## if s == 1, we don't increment, so don't bother
        x&lt;&lt;x[-s,s].inject(:+)while x.max&lt;g&amp;&amp;s&gt;1
        # eval to true if there's a match, false if not
        x[-z,z]==a
    }
}