n,K = map(int,input().split()) W = [int(input()) for _ in range(n)] A = [abs(W[i]) for i in range(n)] A = sorted(A) D = {} cnt = 1 for w in A: if w not in D: D[w] = cnt cnt += 1 k = 0 while 2**k<cnt: k += 1 N = 2**k B = [0 for _ in range(N+1)] def update(i,x): j = i while j<=N: B[j] += x j += j&(-j) def csum(i): tot = 0 j = i while j>0: tot += B[j] j -= j&(-j) return tot for i in range(n): w = W[i] if w>0: j = D[w] if j==1: k = 0 else: k = csum(j-1) if B[N]-k<K: update(j,1) else: w = -w j = D[w] if j==1: k = csum(1) else: k = csum(j)-csum(j-1) if k>0: update(j,-1) print(B[N])