using System.Collections.Generic;
public static void Main()
List<int> list1 = new List<int> { 2, 6, 1, 8, 9, 4, 12, 24, 23, 3, 11, 15 };
List<int> list2 = new List<int> { 6, 9, 4, 12, 24, 23, 5, 16, 18, 2, 7, 14 };
CommonSublist(5, list1, list2).Dump();
private static List<int> CommonSublist(int length, List<int> list1, List<int> list2) {
for (int i=0;i<list1.Count-length;i++) {
for (int j=0;j<list2.Count-length;j++) {
List<int> output = new List<int>();
for (int k=0;k<length;k++) {
if (list1[i+k]==list2[j+k]) {
if (output.Count == length) {