Uiua, 2121 16 bytes
⍢⍢+₁(+1|¬≍↘¯1≡¬≍↘¯1⊃⧈/+:⊙◫↘,,+↘)1 Starting with n = 1, increment untilTry it!
- there is no match of
⍢+₁(...)1Starting with 1, increment until:- dropping the last of
¬≍there is no match between↘¯1dropping the row-wise sumslast of⧈/+the sums of the n-wise windows of the input
↘and dropping the first n rows of the input
- and dropping the first n rows of the input
- dropping the last of