import java.util.*; import java.io.*; import static java.util.Arrays.*; import static java.lang.Math.*; public class No0059 { static final Reader in = new Reader(); static final PrintWriter out = new PrintWriter(System.out,false); static void solve(){ final int SIZE = 100001; 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-1) - ft.get(w-1) < k) ft.add(w,SIZE,1); } else { if (ft.get(-w) - ft.get(-w-1) > 0) ft.add(-w,SIZE,-1); } } out.println(ft.get(SIZE-1)); } public static void main(String[] args) throws Exception { 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[] data; public FenwickTree(int length) { this.length = length; this.data = 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) { data[idx] = (data[idx] + n)%MOD; idx += idx&-idx; } } public long get(int idx) { idx++; long ret = 0; while (idx > 0) { ret = (ret + data[idx])%MOD; idx -= idx&-idx; } return ret; } public String toString() { long[] val = new long[length]; for (int i=0; i