def main1(n,k,a): pre=a[-1] idx=0 for i in reversed(range(k-1)): pre,now=a[i+1],a[i] if pre<40: idx=i break if pre-now in {1,3,5}: return False b=a[:idx+2] ary=[0]*(b[-1]+1) for x in b:ary[x]=1 for i in reversed(range(1,b[-1]+1)): if i+6