import java.util.*; import java.io.*; import java.awt.geom.*; import java.math.*; public class Main { static final Scanner in = new Scanner(System.in); static final PrintWriter out = new PrintWriter(System.out,false); static final int SIZE = 1000001; static void solve() { int n = in.nextInt(); int k = in.nextInt(); FenwickTree ft = new FenwickTree(SIZE); while (n-- > 0) { int w = in.nextInt(); if (w > 0) { if (ft.get(SIZE) - ft.get(w-1) < k) ft.add(w,SIZE,1); } else { w = -w; if (ft.get(w) - ft.get(w-1) > 0) ft.add(w,SIZE,-1); } } out.println(ft.get(SIZE)); } public static void main(String[] args) { long start = System.currentTimeMillis(); solve(); out.flush(); long end = System.currentTimeMillis(); //trace(end-start + "ms"); in.close(); out.close(); } static void trace(Object... o) { System.out.println(Arrays.deepToString(o));} } class FenwickTree { public static final long MOD = 1_000_000_007; public final int length; private long[] bit; public FenwickTree(int length) { this.length = length; this.bit = new long[length+2]; } public void add(int begin, int end, long n) { add(begin, n); add(end, (MOD - n)%MOD); } private void add(int idx, long n) { idx++; while (idx <= length) { bit[idx] = (bit[idx] + n)%MOD; idx += idx&-idx; } } public long get(int idx) { idx++; long ret = 0; while (idx > 0) { ret = (ret + bit[idx])%MOD; idx -= idx&-idx; } return ret; } public String toString() { long[] val = new long[length]; for (int i=0; i