Driver Code
public static void Main ( String [ ] args ) { int [ ] arr = { 1 , 0 , 2 , 2 , 5 , 5 , 5 } ; int N = arr . Length ; int K = 1 ; int length = longestSubarray ( arr , N , K ) ; if ( length == 1 ) Console . Write ( - 1 ) ; else Console . Write ( length ) ; } }