Every evening Vitalya sets n alarm clocks to wake up tomorrow. Every alarm clock rings during exactly one minute and is characterized by one integer a_{i} — number of minute after midnight in which it rings. Every alarm clock begins ringing at the beginning of the minute and rings during whole minute. 

Vitalya will definitely wake up if during some m consecutive minutes at least k alarm clocks will begin ringing. Pay attention that Vitalya considers only alarm clocks which begin ringing during given period of time. He doesn't consider alarm clocks which started ringing before given period of time and continues ringing during given period of time.

Vitalya is so tired that he wants to sleep all day long and not to wake up. Find out minimal number of alarm clocks Vitalya should turn off to sleep all next day. Now all alarm clocks are turned on. 


-----Input-----

First line contains three integers n, m and k (1 ≤ k ≤ n ≤ 2·10^5, 1 ≤ m ≤ 10^6) — number of alarm clocks, and conditions of Vitalya's waking up. 

Second line contains sequence of distinct integers a_1, a_2, ..., a_{n} (1 ≤ a_{i} ≤ 10^6) in which a_{i} equals minute on which i-th alarm clock will ring. Numbers are given in arbitrary order. Vitalya lives in a Berland in which day lasts for 10^6 minutes. 


-----Output-----

Output minimal number of alarm clocks that Vitalya should turn off to sleep all next day long.


-----Examples-----
Input
3 3 2
3 5 1

Output
1

Input
5 10 3
12 8 18 25 1

Output
0

Input
7 7 2
7 3 4 1 6 5 2

Output
6

Input
2 2 2
1 3

Output
0



-----Note-----

In first example Vitalya should turn off first alarm clock which rings at minute 3.

In second example Vitalya shouldn't turn off any alarm clock because there are no interval of 10 consequence minutes in which 3 alarm clocks will ring.

In third example Vitalya should turn off any 6 alarm clocks.

Difficulty: MEDIUM_HARD

Solutions:
(n, m, k) = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
vis = []
for i in range(n):
	vis.append(0)
ans = l = r = 0
cnt = 1
while r < n:
	while a[r] - a[l] + 1 > m:
		if vis[l] == 0:
			cnt -= 1
		l += 1
	if cnt >= k:
		ans += 1
		vis[r] = 1
		cnt -= 1
	r += 1
	cnt += 1
print(ans)


import sys
input = sys.stdin.readline
from collections import *
(n, m, k) = map(int, input().split())
a = list(map(int, input().split()))
t = [0] * (10 ** 6 + 100)
for ai in a:
	t[ai] = 1
now = 0
ans = 0
for i in range(10 ** 6 + 100):
	now += t[i]
	if i >= m:
		now -= t[i - m]
	if now == k:
		t[i] = 0
		now -= 1
		ans += 1
print(ans)


(n, m, k) = list(map(int, input().split()))
arr = list(map(int, input().split()))
arr.sort()
size = k - 1
ans = []
f = 0
i = 0
while i < n:
	if ans == []:
		if len(ans) < size:
			ans.append(arr[i])
			i += 1
		else:
			f += 1
			i += 1
	else:
		u = ans[0]
		limit = u + m - 1
		while i < n:
			if arr[i] <= limit:
				if len(ans) < k - 1:
					ans.append(arr[i])
				else:
					f += 1
				i += 1
			else:
				break
		ans.pop(0)
print(f)


(n, m, k) = list(map(int, input().split()))
cnt = [0] * (10 ** 6 + 5)
l = [int(i) for i in input().split()]
for i in l:
	cnt[i] += 1
sm = 0
for i in range(10 ** 6 + 5):
	sm += cnt[i]
	if i >= m:
		sm -= cnt[i - m]
	if sm >= k:
		sm -= 1
		cnt[i] = 0
print(n - sum(cnt))


(n, m, k) = list(map(int, input().split()))
a = list(map(int, input().split()))
a.sort()
d = []
ans = 0
for i in a:
	if len(d) > 0 and d[0] < i - m + 1:
		del d[0]
	if len(d) < k - 1:
		d.append(i)
	else:
		ans += 1
print(ans)


import heapq
import sys
input = sys.stdin.readline
for _ in range(1):
	(n, m, k) = map(int, input().split())
	l = list(map(int, input().split()))
	if k == 1:
		print(n)
		continue
	l.sort()
	h = []
	heapq.heapify(h)
	ans = 0
	for i in l:
		if len(h) + 1 == k:
			if i - h[0] + 1 <= m:
				ans += 1
				continue
			while len(h) > 0:
				if i - h[0] + 1 > m:
					heapq.heappop(h)
				else:
					break
			heapq.heappush(h, i)
		else:
			heapq.heappush(h, i)
	print(ans)


(n, m, k) = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
a.sort()
ans = 0
z = 0
j = 0
for i in range(len(a)):
	if a[i] == 0:
		z -= 1
		continue
	while j < len(a) and a[j] - a[i] < m:
		if a[j] == 0:
			z += 1
		j += 1
	if j - i - z >= k:
		const = j - i - k - z + 1
		c = 0
		ct = 0
		while ct < const:
			if a[j - 1 - c] != 0:
				a[j - 1 - c] = 0
				ans += 1
				ct += 1
				if j - 1 - c != i:
					z += 1
			c += 1
print(ans)


k = input().split()
(n, m, k) = (int(k[0]), int(k[1]), int(k[2]))
a = [0] * 1000001
c = input().split()
for i in range(n):
	a[int(c[i])] = 1
b = 0
p = 0
for i in range(m):
	if a[i] == 1:
		p += 1
	if p == k:
		a[i] = 0
		p -= 1
		b += 1
for i in range(m, 1000001):
	if a[i - m] == 1:
		p -= 1
	if a[i] == 1:
		p += 1
	if p == k:
		a[i] = 0
		p -= 1
		b += 1
print(b)


(n, m, k) = map(int, input().split())
Alarm = [int(x) for x in input().split()]
ringing_now = []
Ans = 0
Alarm = list(set(Alarm))
Alarm.sort()
for i in range(n):
	ringing_now.append(Alarm[i])
	if len(ringing_now) >= k and ringing_now[-1] - ringing_now[len(ringing_now) - k] < m:
		ringing_now.pop()
		Ans += 1
print(Ans)


from sys import stdin, exit, setrecursionlimit
from collections import deque
from string import ascii_lowercase
from itertools import *
from math import *
input = stdin.readline
lmi = lambda : list(map(int, input().split()))
mi = lambda : map(int, input().split())
si = lambda : input().strip('\n')
ssi = lambda : input().strip('\n').split()
mod = 10 ** 9 + 7
(n, m, k) = mi()
a = lmi()
a.sort()
q = deque()
cnt = 0
for i in range(n):
	q.append(i)
	while a and a[q[-1]] - a[q[0]] > m - 1:
		q.popleft()
	while len(q) >= k:
		q.pop()
		cnt += 1
print(cnt)


(n, m, k) = list(map(int, input().split()))
times = list(map(int, input().split()))
times.sort()
ans = 0
start = 0
cnt = 0
j = 0
prohibited = []
for i in range(n):
	prohibited += [1]
for i in range(n):
	if times[i] < start + m:
		cnt += 1
	else:
		while times[i] >= start + m:
			if prohibited[j] == 1:
				start = times[j]
				if j != 0:
					cnt -= 1
			j += 1
		cnt += 1
	if cnt == k:
		cnt -= 1
		ans += 1
		prohibited[i] = 0
if k == 1:
	print(n)
else:
	print(ans)


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def list2d(a, b, c):
	return [[c] * b for i in range(a)]

def list3d(a, b, c, d):
	return [[[d] * c for j in range(b)] for i in range(a)]

def list4d(a, b, c, d, e):
	return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]

def ceil(x, y=1):
	return int(-(-x // y))

def Yes():
	print('Yes')

def No():
	print('No')

def YES():
	print('YES')

def NO():
	print('NO')
INF = 10 ** 18
MOD = 10 ** 9 + 7
from fractions import Fraction
from math import floor, ceil
Ri = lambda : [int(x) for x in sys.stdin.readline().split()]
ri = lambda : sys.stdin.readline().strip()
(n, m, k) = Ri()
a = Ri()
lis = [0] * (10 ** 6 + 1)
for i in a:
	lis[i] += 1
a = lis
cnt = 0
ans = 0
for i in range(m):
	cnt += a[i]
	if cnt >= k:
		toremove = 1
		a[i] -= toremove
		ans += toremove
		cnt -= 1
for i in range(m, 10 ** 6 + 1):
	cnt += a[i]
	cnt -= a[i - m]
	if cnt >= k:
		toremove = 1
		a[i] -= toremove
		ans += toremove
		cnt -= 1
print(ans)


import sys
import math as mt
import bisect
t = 1

def solve():
	(i, j, ans) = (0, 0, 0)
	ind = [0] * n
	(suma, ex) = (1, 0)
	j = 0
	for i in range(n):
		if j < n and ind[i] == 0:
			while j < n:
				if l[j] - l[i] + 1 <= m:
					if j - i + 1 - ex >= k:
						diff = j - i + 1 - ex - k + 1
						for j1 in range(j, j - diff, -1):
							ind[j1] = 1
						ans += diff
						ex += diff
				else:
					if k == 1:
						ans += 1
					break
				j += 1
		else:
			ex -= 1
	return ans
for _ in range(t):
	(n, m, k) = map(int, input().split())
	l = list(map(int, input().split()))
	l.sort()
	print(solve())


from sys import stdin, stdout
import math
import heapq
from itertools import accumulate
(N, M, K) = [int(x) for x in stdin.readline().split()]
arr = [int(x) for x in stdin.readline().split()]
freq = [0] * 1000000
for num in arr:
	freq[num - 1] += 1
s = 0
res = 0
for i in range(1000000):
	if i >= M:
		s -= freq[i - M]
	s += freq[i]
	if s >= K:
		res += s - K + 1
		freq[i] -= s - K + 1
		s -= s - K + 1
print(res)


import sys
input = sys.stdin.readline
(n, m, k) = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
t = [0] * (10 ** 6 + 1)
for i in range(n):
	t[a[i]] += 1
cnt = 0
ans = 0
for i in range(10 ** 6 + 1):
	cnt += t[i]
	if i >= m:
		cnt -= t[i - m]
	if cnt == k:
		ans += 1
		cnt -= 1
		t[i] = 0
print(ans)


from collections import Counter, deque

def lInt(d=None):
	return map(int, input().split(d))
(n, m, k, *_) = lInt()
a = list(lInt())
f = [0] * 1000002
d = deque()
acc = 0
ans = 0
for v in a:
	f[v] = 1
for i in range(1, m + 1):
	if f[i]:
		acc += f[i]
		d.append(i)
for i in range(m + 1, 1000002):
	while acc >= k:
		j = d.pop()
		if f[j]:
			f[j] = 0
			ans += 1
			acc -= 1
	if f[i]:
		acc += f[i]
		d.append(i)
	if f[i - m]:
		acc -= 1
print(ans)


from collections import *
al = defaultdict(int)
(n, u, k) = map(int, input().split())
z = list(map(int, input().split()))
z.sort()
m = z.copy()
if k == 1:
	print(len(z))
	exit()
al = defaultdict(int)
total = 0
point = 0
for i in range(len(z)):
	if point >= len(z):
		break
	if i == 0:
		point = m[k - 1]
		count = 0
		for j in range(k - 1, len(z)):
			if m[j] - z[i] + 1 > u:
				break
			else:
				count += 1
				al[j] = 1
		total += count
		point = j
		gap = k
	elif al[i] == 0:
		gap -= 1
		while gap < k:
			if al[point] == 0:
				point += 1
				gap += 1
			else:
				point += 1
		count = 0
		for j in range(point, len(z)):
			if z[j] - z[i] + 1 > u:
				break
			else:
				count += 1
				al[j] = 1
		total += count
		point = j
		gap = k
	else:
		continue
print(total)


(n, m, k) = list(map(int, input().split()))
a = list(map(int, input().split()))
a.sort()
from collections import deque
d = deque([])
ans = 0
for i in a:
	if len(d) > 0 and d[0] < i - m + 1:
		d.popleft()
	if len(d) < k - 1:
		d.append(i)
	else:
		ans += 1
print(ans)


from __future__ import division, print_function
import sys
if sys.version_info[0] < 3:
	from __builtin__ import xrange as range
	from future_builtins import ascii, filter, hex, map, oct, zip
import os, sys, bisect, copy
from collections import defaultdict, Counter, deque
if os.path.exists('in.txt'):
	sys.stdin = open('in.txt', 'r')
if os.path.exists('out.txt'):
	sys.stdout = open('out.txt', 'w')

def input():
	return sys.stdin.readline()

def mapi(arg=0):
	return map(int if arg == 0 else str, input().split())
(n, m, k) = mapi()
a = list(mapi())
a.sort()
mp = []
res = 0
for i in a:
	mp.append(i)
	while mp[-1] - mp[0] >= m:
		mp.pop(0)
	while len(mp) >= k:
		mp.pop()
		res += 1
print(res)


(n, m, k) = list(map(int, input().split()))
a = list(map(int, input().split()))
a = list(sorted(a))
s = []
r = 0
for x in a:
	if len(s) and s[0] < x - m + 1:
		del s[0]
	if len(s) < k - 1:
		s.append(x)
	else:
		r += 1
print(r)


import sys
input = sys.stdin.readline

def factorial(x, m):
	val = 1
	while x > 0:
		val = val * x % m
		x -= 1
	return val

def fact(x):
	val = 1
	while x > 0:
		val *= x
		x -= 1
	return val

def swaparr(arr, a, b):
	temp = arr[a]
	arr[a] = arr[b]
	arr[b] = temp

def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)

def nCr(n, k):
	if k > n:
		return 0
	if k > n - k:
		k = n - k
	res = 1
	for i in range(k):
		res = res * (n - i)
		res = res / (i + 1)
	return int(res)

def primefs(n):
	primes = {}
	while n % 2 == 0 and n > 0:
		primes[2] = primes.get(2, 0) + 1
		n = n // 2
	for i in range(3, int(n ** 0.5) + 2, 2):
		while n % i == 0 and n > 0:
			primes[i] = primes.get(i, 0) + 1
			n = n // i
	if n > 2:
		primes[n] = primes.get(n, 0) + 1
	return primes

def power(x, y, p):
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def sieve(n):
	prime = [True for i in range(n + 1)]
	(prime[0], prime[1]) = (False, False)
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	return prime

def is_prime(n):
	if n == 0:
		return False
	if n == 1:
		return True
	for i in range(2, int(n ** (1 / 2)) + 1):
		if not n % i:
			return False
	return True
MAXN = int(100000.0 + 5)
import math

def spf_sieve():
	spf[1] = 1
	for i in range(2, MAXN):
		spf[i] = i
	for i in range(4, MAXN, 2):
		spf[i] = 2
	for i in range(3, math.ceil(MAXN ** 0.5), 2):
		if spf[i] == i:
			for j in range(i * i, MAXN, i):
				if spf[j] == j:
					spf[j] = i
spf = [0 for i in range(MAXN)]

def factoriazation(x):
	res = []
	for i in range(2, int(x ** 0.5) + 1):
		while x % i == 0:
			res.append(i)
			x //= i
	if x != 1:
		res.append(x)
	return res

def factors(n):
	res = []
	for i in range(1, int(n ** 0.5) + 1):
		if n % i == 0:
			res.append(i)
			res.append(n // i)
	return list(set(res))

def int_array():
	return list(map(int, input().strip().split()))

def float_array():
	return list(map(float, input().strip().split()))

def str_array():
	return input().strip().split()
MOD = int(1000000000.0) + 7
CMOD = 998244353
INF = float('inf')
NINF = -float('inf')
from itertools import permutations
import math
from bisect import bisect_left
from collections import Counter
import heapq
from collections import Counter
from bisect import bisect_right
import heapq
import math

def divisors_seive(n):
	divisors = [10 ** 6 + 6]
	for i in range(1, n + 1):
		for j in range(i, n + 1):
			divisors[j] += 1

def dfs(s, par, vis, rank):
	vis[s] = 1
	global res
	res = 1
	rank[s] = 1
	f = 0
	for i in g[s]:
		f = 1
		if par == i:
			continue
		rank[s] += dfs(i, s)
	return res
import bisect
from collections import deque
(n, m, k) = map(int, input().split())
arr = list(map(int, input().split()))
arr.sort()
d = deque([])
ans = 0
for i in arr:
	if len(d) > 0 and d[0] < i - m + 1:
		d.popleft()
	if len(d) < k - 1:
		d.append(i)
	else:
		ans += 1
print(ans)


(n, m, k) = list(map(int, input().strip().split()))
a = list(map(int, input().strip().split()))
a.sort()
count = 0
start = 0
konec = 0
ur = 0
while start < len(a):
	if a[start] is not None:
		v = a[start]
		while konec < len(a) and a[konec] - v < m:
			ur += 1
			if ur >= k:
				a[konec] = None
				count += 1
				ur -= 1
			konec += 1
	if a[start] is not None:
		ur -= 1
	start += 1
print(count)


(n, m, k) = [int(x) for x in input().split()]
alarms = [int(x) for x in input().split()]
alarms.sort()
al2 = []
cont = 0
for i in range(len(alarms)):
	al2.append(alarms[i])
	if len(al2) >= k and al2[-1] - al2[len(al2) - k] < m:
		al2.pop()
		cont += 1
print(cont)


from collections import deque
(n, m, k) = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
a = sorted(a)
a = deque(a)
first = -100000000.0
r = deque([])
s = 0
result = 0
while n > 0:
	e = a[0]
	c = e - m + 1
	while r != deque([]):
		if r[0] < c:
			r.popleft()
			s -= 1
		else:
			break
	if s + 1 >= k:
		result += 1
	else:
		r.append(e)
		s += 1
	a.popleft()
	n -= 1
print(result)


f = lambda : map(int, input().split())
(n, m, k) = f()
t = sorted(f())
d = [1] * n
i = s = 0
for j in range(n):
	while t[j] - t[i] >= m:
		k += d[i]
		i += 1
	k -= 1
	if k < 1:
		s += 1
		k = 1
		d[j] = 0
print(s)


import sys, os, io
from sys import stdin
from math import log, gcd, ceil
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import math
alphabets = list('abcdefghijklmnopqrstuvwxyz')

def isPrime(x):
	for i in range(2, x):
		if i * i > x:
			break
		if x % i == 0:
			return False
	return True

def ncr(n, r, p):
	num = den = 1
	for i in range(r):
		num = num * (n - i) % p
		den = den * (i + 1) % p
	return num * pow(den, p - 2, p) % p

def primeFactors(n):
	l = []
	while n % 2 == 0:
		l.append(2)
		n = n / 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			l.append(int(i))
			n = n / i
	if n > 2:
		l.append(n)
	return list(set(l))

def power(x, y, p):
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def SieveOfEratosthenes(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	return prime

def countdig(n):
	c = 0
	while n > 0:
		n //= 10
		c += 1
	return c

def si():
	return input()

def prefix_sum(arr):
	r = [0] * (len(arr) + 1)
	for (i, el) in enumerate(arr):
		r[i + 1] = r[i] + el
	return r

def divideCeil(n, x):
	if n % x == 0:
		return n // x
	return n // x + 1

def ii():
	return int(input())

def li():
	return list(map(int, input().split()))

def ws(s):
	sys.stdout.write(s + '\n')

def wi(n):
	sys.stdout.write(str(n) + '\n')

def wia(a):
	sys.stdout.write(' '.join([str(x) for x in a]) + '\n')

def power_set(L):
	cardinality = len(L)
	n = 2 ** cardinality
	powerset = []
	for i in range(n):
		a = bin(i)[2:]
		subset = []
		for j in range(len(a)):
			if a[-j - 1] == '1':
				subset.append(L[j])
		powerset.append(subset)
	powerset_orderred = []
	for k in range(cardinality + 1):
		for w in powerset:
			if len(w) == k:
				powerset_orderred.append(w)
	return powerset_orderred

def fastPlrintNextLines(a):
	print('\n'.join(map(str, a)))

def sortByFirstAndSecond(A):
	A = sorted(A, key=lambda x: x[0])
	A = sorted(A, key=lambda x: x[1])
	return list(A)
if os.path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
else:
	input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
t = 1
for _ in range(t):
	(n, m, k) = li()
	a = li()
	a.sort()
	a1 = []
	cnt = 0
	for i in range(n):
		a1.append(a[i])
		if len(a1) >= k and a1[-1] - a1[len(a1) - k] < m:
			a1.pop()
			cnt += 1
	print(cnt)


(n, m, k) = list(map(int, input().split()))
clock = list(map(int, input().split()))
clock.sort()
unlock = [1] * n
count = 0
j = 0
if k == 1:
	count = n
else:
	for i in range(n):
		while clock[i] - clock[j] >= m:
			k += unlock[j]
			j += 1
		k -= 1
		if k < 1:
			count += 1
			k = 1
			unlock[i] = 0
print(count)


(n, m, k) = map(int, input().split())
lis = sorted(map(int, input().split())) + [1000000000000000]
j = zer = ans = 0
for i in range(n):
	if lis[i] == 0:
		zer -= 1
		continue
	j = max(j, i)
	while j <= n and lis[j] - lis[i] < m:
		j += 1
	if j - i - zer >= k:
		a = j - 1
		ext = j - i - zer - k + 1
		t = 0
		while a >= 0 and ext > 0:
			if lis[a] != 0:
				lis[a] = 0
				t += 1
				zer += 1
				ext -= 1
			a -= 1
		ans += t
	if lis[i] == 0:
		zer -= 1
print(ans)


(n, m, k) = (int(x) for x in input().split())
ns = set((int(x) for x in input().split()))
from collections import deque
span = deque((0 for i in range(m)))
kk = 0
res = 0
mm = -1
while len(ns) > 0:
	mm += 1
	x = span.popleft()
	if x == 1:
		kk -= 1
	if mm not in ns:
		span.append(0)
	else:
		ns.remove(mm)
		y = 1
		if kk == k - 1:
			res += 1
			y = 0
		span.append(y)
		kk += y
print(res)