You are given a number $k$ and a string $s$ of length $n$, consisting of the characters '.' and '*'. You want to replace some of the '*' characters with 'x' characters so that the following conditions are met:

The first character '*' in the original string should be replaced with 'x';

The last character '*' in the original string should be replaced with 'x';

The distance between two neighboring replaced characters 'x' must not exceed $k$ (more formally, if you replaced characters at positions $i$ and $j$ ($i < j$) and at positions $[i+1, j-1]$ there is no "x" symbol, then $j-i$ must be no more than $k$).

For example, if $n=7$, $s=$.**.*** and $k=3$, then the following strings will satisfy the conditions above:

.xx.*xx;

.x*.x*x;

.xx.xxx.

But, for example, the following strings will not meet the conditions:

.**.*xx (the first character '*' should be replaced with 'x');

.x*.xx* (the last character '*' should be replaced with 'x');

.x*.*xx (the distance between characters at positions $2$ and $6$ is greater than $k=3$).

Given $n$, $k$, and $s$, find the minimum number of '*' characters that must be replaced with 'x' in order to meet the above conditions.


-----Input-----

The first line contains one integer $t$ ($1 \le t \le 500$). Then $t$ test cases follow.

The first line of each test case contains two integers $n$ and $k$ ($1 \le k \le n \le 50$).

The second line of each test case contains a string $s$ of length $n$, consisting of the characters '.' and '*'.

It is guaranteed that there is at least one '*' in the string $s$.

It is guaranteed that the distance between any two neighboring '*' characters does not exceed $k$.


-----Output-----

For each test case output the minimum number of '*' characters that must be replaced with 'x' characters in order to satisfy the conditions above.


-----Examples-----

Input
5
7 3
.**.***
5 1
..*..
5 2
*.*.*
3 2
*.*
1 1
*
Output
3
1
3
2
1


-----Note-----

None

Difficulty: EASY
Tags: Implementation

Greedy algorithms
Skill types: Greedy algorithms

Starter code:

Solutions:
for i in range(int(input())):
	(n, k) = map(int, input().split())
	s = input()
	c = 1
	f = s.find('*')
	while f < s.rfind('*'):
		f = s.rfind('*', f, f + k + 1)
		c += 1
	print(c)


from collections import *
from sys import exit
from copy import deepcopy as copy
INF = 1000000000.0 + 7
t = int(input())
ans = [None for _ in range(t)]
for _ in range(t):
	(n, k) = map(int, input().split())
	s = input().strip()
	fst_pos = None
	good = INF
	prev = INF
	for (i, c) in enumerate(s):
		if c == '*':
			prev = i
			if fst_pos is None:
				fst_pos = i
				ans = 1
				good = i
		if i - good >= k:
			if prev != good:
				ans += 1
				good = prev
	if good != prev:
		ans += 1
	print(ans)


t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	s = input()
	for i in range(n):
		if s[i] == '*':
			x = i
			break
	for i in range(n - 1, -1, -1):
		if s[i] == '*':
			y = i
			break
	res = 0
	if x == y:
		print(1)
	else:
		i = x
		while i >= x and i < y:
			if s[i] == '*':
				z = i + k
				while z < y and z > i:
					if s[z] == '*':
						res += 1
						break
					z -= 1
			i = z
		print(res + 2)


t = int(input())
for _ in range(t):
	(n, k) = tuple(map(int, input().split()))
	string = input().strip('.')
	n = len(string)
	if n == 1:
		print('1')
	else:
		precomp = [-1] * n
		lastOcc = -1
		for i in range(n):
			precomp[i] = i if string[i] == '*' else precomp[i - 1]
		i = 0
		count = 0
		prev = 0
		while i < n:
			if string[i] == '*':
				count += 1
				i = i + k
			else:
				i = precomp[i]
		temp = 0 if i - k == n - 1 else 1
		print(count + temp)


import math
import math
from collections import defaultdict, Counter
from itertools import permutations

def fact(n):
	return 1 if n == 1 or n == 0 else n * fact(n - 1)

def prime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True

def inp():
	l = list(map(int, input().split()))
	return l

def main():
	for _ in range(int(input())):
		(n, k) = list(map(int, input().split()))
		s = input()
		l = s.find('*')
		r = s.rfind('*')
		if l == r:
			print(1)
		else:
			c = 2
			while r - l > k:
				l = s[:l + k + 1].rfind('*')
				c += 1
			print(c)
import os, 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')
main()

def random():
	rating = 100
	rating = rating * 100
	rating = rating * 100
	print(rating)

def random():
	rating = 100
	rating = rating * 100
	rating = rating * 100
	print(rating)

def random():
	rating = 100
	rating = rating * 100
	rating = rating * 100
	print(rating)

def random():
	rating = 100
	rating = rating * 100
	rating = rating * 100
	print(rating)


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	s = input()
	sim = -1
	h = 0
	count = 0
	for i in range(n):
		if sim == -1 and s[i] == '*':
			count += 1
			sim = i
		if s[i] == '*':
			h = i
		if i - sim >= k and sim != -1 and (sim != h):
			sim = h
			count += 1
	if h != sim:
		count += 1
	print(count)


def partialReplacement(n, k, string):
	string = list(string)
	stars = []
	for x in range(n):
		if string[x] == '*':
			stars.append(x)
	if len(stars) in (0, 1, 2):
		return len(stars)
	ans = 2
	x = 0
	while x < len(stars):
		if stars[x] + k >= stars[-1]:
			return ans
		y = x
		while stars[x] + k > stars[y]:
			y += 1
		if stars[x] + k < stars[y]:
			y -= 1
		x = y
		ans += 1
	return ans
t = int(input())
final = []
for _ in range(t):
	(n, k) = map(int, input().split())
	string = input()
	final.append(partialReplacement(n, k, string))
for _ in range(t):
	print(final[_])


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	s = list(input())
	mylist = []
	for i in range(n):
		if s[i] == '*':
			mylist.append(i)
	s[mylist[0]] = 'x'
	s[mylist[-1]] = 'x'
	i = 0
	j = 1
	while j < len(mylist) - 1:
		if mylist[j] - mylist[i] < k:
			if mylist[j + 1] - mylist[i] <= k:
				j += 1
				continue
		s[mylist[j]] = 'x'
		i = j
		j = i + 1
	print(s.count('x'))


from math import floor

def pc(s, cp, k):
	for i in range(min(len(s) - 1, cp + k), cp, -1):
		if s[i] == '*':
			return i
	return cp
n = int(input())
for v in range(n):
	(n, k) = map(int, input().split(' '))
	s = input()
	f = s.find('*')
	n = s.rfind('*', f, f + k + 1)
	a = 1
	while f != n and n != -1:
		a = a + 1
		f = n
		n = s.rfind('*', f, f + k + 1)
	print(a)


T = int(input())
for i in range(T):
	(n, k) = map(int, input().split())
	s = list(map(str, input().split()))
	result = 1
	l = min((s[0].find('*') for i in s[0]))
	while True:
		r = min(n - 1, l + k)
		while s[0][r] != '*' and r >= l:
			r = r - 1
		if r == l:
			break
		l = r
		result = result + 1
	print(result)


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	s = input()
	i = 0
	ans = 0
	while i < n:
		if s[i] == '*':
			dis = k
			ans += 1
			while (i + dis >= n or s[i + dis] != '*') and dis > 0:
				dis -= 1
			if dis == 0:
				break
			i += dis
		else:
			i += 1
	print(ans)


t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	s = list(input())
	l = len(s)
	pos1 = pos2 = -1
	for i in range(l):
		if s[i] == '*':
			if pos1 == -1:
				pos1 = i
			pos2 = i
	s[pos1] = s[pos2] = 'x'
	if pos1 == pos2:
		ans = 1
	else:
		ans = 2
	curr = pos1
	while curr < pos2:
		last = -1
		for i in range(curr + 1, min(curr + k + 1, pos2 + 1)):
			if s[i] == '*' or s[i] == 'x':
				last = i
		if s[last] == '*':
			s[last] = 'x'
			curr = last
			ans += 1
		else:
			break
	print(ans)


import os
import math
import sys
parse_input = lambda : sys.stdin.readline().rstrip('\r\n')

def func(n, k, string):
	first_ind = string.find('*')
	last_ind = string.rfind('*')
	count = 2
	if first_ind == last_ind:
		return 1
	else:
		i = first_ind
		while i < last_ind - k:
			j = k
			while j > 0:
				if i + j == last_ind:
					return count
				elif string[i + j] == '*':
					count += 1
					i += j
					j = 0
				else:
					j -= 1
		return count
n = 7
k = 3
s = '.**.***'
func(n, k, s)

def main():
	n_cases = int(parse_input())
	for i in range(n_cases):
		(n, k) = [int(i) for i in parse_input().split()]
		string = parse_input()
		print(func(n, k, string))
main()


from io import BytesIO, IOBase
import sys, os
inpl = lambda : list(map(int, input().split()))
inpm = lambda : map(int, input().split())
inpi = lambda : int(input())
inp = lambda : input()
(rev, ra, l) = (reversed, range, len)
P = print
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))

def input():
	return sys.stdin.readline().rstrip('\r\n')
from bisect import bisect_left as bl
from bisect import bisect_right as br
import sys, operator, math, operator
from collections import Counter
import random
tc = inpi()
while tc:
	tc -= 1
	(n, k) = inpm()
	st = inp()
	i = 0
	ans = 0
	tr = True
	while i < n and st[i] != '*':
		i += 1
	if i <= n - 1:
		ans += 1
		if i != n - 1:
			st = st[:i] + 'x' + st[i + 1:]
		else:
			st = st[:i] + 'x'
	else:
		tr = False
		P(0)
	if tr:
		tr1 = True
		i = n - 1
		while i >= 0 and st[i] != '*':
			i -= 1
		if i < 0:
			tr1 = False
			P(ans)
		else:
			ans += 1
			if i != n - 1:
				st = st[:i] + 'x' + st[i + 1:]
			else:
				st = st[:i] + 'x'
		if tr1:
			for i in ra(n - 1):
				if st[i] == 'x':
					last = 0
					rep = True
					for j in ra(1, k + 1):
						if i + j < n:
							if st[i + j] == '*':
								last = i + j
					for j in ra(i + 1, l(st)):
						if st[j] == 'x':
							if j - i > k:
								if last + 1 != n:
									st = st[:last] + 'x' + st[last + 1:]
								else:
									st = st[:last] + 'x'
								ans += 1
								break
							else:
								break
			P(ans)


def solve():
	(n, k) = map(int, input().split())
	s = input()
	a = [0] * n
	for i in range(n):
		if s[i] == '*':
			a[i] = 1
	for i in range(n):
		if a[i] == 1:
			a[i] = 2
			break
	for i in range(n - 1, -1, -1):
		if a[i] == 1:
			a[i] = 2
			break
	for i in range(n):
		if a[i] == 2:
			j = min(n - 1, i + k)
			while a[j] == 0:
				j -= 1
			ok = True
			if a[j] == 2:
				ok = False
			for l in range(i + 1, j):
				if a[l] == 2:
					ok = False
			if not ok:
				break
			a[j] = 2
			i = j - 1
	print(a.count(2))
t = int(input())
for i in range(t):
	solve()


I = input
exec(int(I()) * "k=int(I().split()[1]);s=I().strip('.');r=i=1\nwhile i<len(s):i=s.rfind('*',i,i+k)+1;r+=1\nprint(r)\n")


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	s = input()
	t = []
	count = 0
	ct = s.count('*')
	if ct == 1 or ct == 2:
		print(ct)
		continue
	if k == 1:
		print(ct)
		continue
	for i in range(n):
		if s[i] == '*':
			t.append(i)
	count += 1
	c = t[0]
	for i in range(1, len(t)):
		if t[i] > c + k:
			count += 1
			c = t[i - 1]
	print(count + 1)


k = int(input())

def findbest(place, jump, list):
	for i in range(jump):
		if current + k - i in list:
			return current + k - i
for i in range(k):
	(n, k) = map(int, input().split())
	inds = [j for (j, x) in enumerate(list(input())) if x == '*']
	if len(inds) == 1 or len(inds) == 2:
		print(len(inds))
	else:
		start = inds[0]
		end = inds[-1]
		current = start
		tick = 0
		while end - current > k:
			current = findbest(current, k, inds)
			tick += 1
		print(tick + 2)


t = int(input())
for i in range(t):
	(n, k) = [int(x) for x in input().split()]
	retazec = input()
	for i in range(n):
		if retazec[i] == '*':
			prva = i
			break
	for i in range(n):
		if retazec[n - 1 - i] == '*':
			posledna = n - 1 - i
			break
	i = prva
	pocet = 1
	while i != posledna:
		for j in range(1, 1 + min(k, n - 1 - i)):
			if retazec[i + j] == '*':
				teraz = i + j
		i = teraz
		pocet += 1
	print(pocet)


t = int(input())
for _ in range(t):
	(n, k) = [int(i) for i in input().split()]
	s = input()
	s = list(s)
	res = 0
	ind = 0
	ind_start = 0
	while ind_start <= len(s) - 1 and s[ind_start] != '*':
		ind_start += 1
	if ind_start <= len(s) - 1:
		res += 1
		s[ind_start] = 'x'
	ind_end = len(s) - 1
	while ind_end >= 0 and s[ind_end] != '*':
		ind_end -= 1
	if ind_end < 0:
		ind_end = ind_start
	ind = ind_start
	while ind < ind_end:
		ind_next = min(ind + k, ind_end)
		while ind_next >= ind and s[ind_next] != '*':
			ind_next -= 1
		if ind_next >= ind:
			res += 1
			ind = ind_next
			if ind == ind_end:
				break
		else:
			print('BREAK')
			print(ind, ind_next)
			break
	print(res)


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	s = input()
	if s.count('*') == 1:
		print(1)
		continue
	l = list(s)
	t = s.find('*')
	l[t] = 'x'
	r = s.rfind('*')
	l[r] = 'x'
	c = 2
	while t < r:
		if t + k >= r:
			break
		j = t + k
		while l[j] != '*':
			j -= 1
		l[j] = 'x'
		c += 1
		t = j
	print(c)


def main():
	(n, k) = [int(x) for x in input().split()]
	s = input()
	res = 1
	i = s.find('*')
	while True:
		j = min(n - 1, i + k)
		while i < j and s[j] == '.':
			j -= 1
		if i == j:
			break
		else:
			res += 1
			i = j
	print(res)
	return
t = int(input())
for i in range(t):
	main()


T = int(input())

def f(s, n, k):
	i = 0
	while i < n and s[i] != '*':
		i += 1
	j = n - 1
	if i >= n:
		return 0
	while j >= 0 and s[j] != '*':
		j -= 1
	a = 2
	if i == j:
		return 1
	while i < j:
		if j - i <= k:
			break
		c = 0
		li = i
		while i < j and c < k:
			c += 1
			i += 1
			if s[i] == '*':
				li = i
		if i < j:
			a += 1
			i = li
	return a
for t in range(T):
	(n, k) = map(int, input().split())
	s = input()
	print(f(s, n, k))


for w in range(int(input())):
	(n, k) = tuple(map(int, input().split()))
	s = str(input())
	s = list(s)
	ans = 0
	i = 0
	while i < n:
		if s[i] == '*':
			ans += 1
			s[i] = 'x'
			j = i + k
			if j > n - 1:
				i = n
				break
			while j < n and j > i and (s[j] != '*'):
				j -= 1
			i = min(j, n - 1)
		else:
			i += 1
	for i in reversed(range(n)):
		if s[i] == 'x':
			break
		elif s[i] == '*':
			ans += 1
			break
	print(ans)


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	s = input()
	a = []
	for i in range(n):
		if s[i] == '*':
			a.append(i)
	fi = a[0]
	ans = 1
	a = a[1:]
	prev = fi
	for i in range(len(a)):
		el = a[i]
		if el - prev > k:
			prev = a[i - 1]
			ans += 1
	if a and fi != a[-1]:
		ans += 1
	print(ans)


t = int(input())
for i in range(t):
	line = input()
	prms = line.split(' ')
	n = prms[0]
	k = int(prms[1])
	line = input()
	lastStarI = -9
	lastXI = -9
	count = 0
	dist = 0
	firstStar = True
	newStr = []
	for i in range(len(line)):
		char = line[i]
		if char == '*':
			if firstStar:
				count += 1
				lastXI = i
				lastXI = lastStarI
				firstStar = False
				dist = 0
				newStr.append('X')
				continue
			if dist == k - 1:
				count += 1
				dist = 0
				lastXI = i
				lastXI = lastStarI
				newStr.append('X')
				continue
			if dist > k - 1:
				count += 1
				lastXI = lastStarI
				lastStarI = i
				dist = i - lastXI
				newStr[lastXI] = 'X'
				newStr.append(char)
				continue
			lastStarI = i
		newStr.append(char)
		dist += 1
	if lastXI != lastStarI:
		count += 1
		newStr[lastStarI] = 'X'
	print(count)


T = int(input())
for case in range(T):
	(n, k) = map(int, input().split())
	s = list(input())
	if s.count('*') == 1:
		print(1)
		continue
	count = 0
	for i in range(n):
		if s[i] == '*':
			s[i] = 'x'
			count += 1
			left = i
			break
	for i in range(n - 1, -1, -1):
		if s[i] == '*':
			right = i
			s[i] = 'x'
			count += 1
			break
	while left + k < right:
		for i in range(left + k, left, -1):
			if s[i] == 'x':
				left = i
				break
			elif s[i] == '*':
				s[i] == 'x'
				left = i
				count += 1
				break
	print(count)


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	s = input()
	f = s.find('*')
	l = s.rfind('*')
	if f == l:
		print(1)
	else:
		ans = 2
		while l - f > k:
			f = s[:f + k + 1].rfind('*')
			ans += 1
		print(ans)


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	S = list(input())
	c = 0
	for i in range(0, len(S)):
		if S[i] == '*':
			S[i] = 'x'
			c += 1
			break
	for i in range(0, len(S)):
		if S[i] == 'x':
			j = i + k
			while j > i:
				if j < len(S) and S[j] == '*':
					S[j] = 'x'
					c += 1
					break
				j -= 1
	print(c)


import bisect
import collections
import functools
import itertools
import math
import heapq
import random
import string

def repeat(_func=None, *, times=1):

	def decorator(func):

		@functools.wraps(func)
		def wrapper(*args, **kwargs):
			for _ in range(times):
				func(*args, **kwargs)
		return wrapper
	if _func is None:
		return decorator
	else:
		return decorator(_func)

def unpack(func=int):
	return map(func, input().split())

def l_unpack(func=int):
	return list(map(func, input().split()))

def getint():
	return int(input())

def getmatrix(rows):
	return [list(map(int, input().split())) for _ in range(rows)]

def display_matrix(mat):
	for i in range(len(mat)):
		print(mat[i])

@repeat(times=int(input()))
def main():
	(n, k) = unpack()
	s = list(input())
	pos = n
	cnt = 0
	for i in range(n):
		if s[i] == '*':
			s[i] = 'x'
			pos = i
			cnt += 1
			break
	while pos < n:
		j = min(pos + k, n - 1)
		while j > pos:
			if s[j] == '*':
				s[j] = 'x'
				pos = j
				cnt += 1
				break
			j -= 1
		else:
			break
	print(cnt)
MOD = 10 ** 9 + 7
main()


import math
t = int(input())
for i in range(0, t):
	(a, b) = input().split()
	a = int(a)
	b = int(b)
	s = str(input())
	f = []
	h = 0
	for i in range(0, len(s)):
		if s[i] == '*':
			f.append(i)
	if len(f) < 3:
		print(len(f))
	else:
		y = f[0]
		for j in range(0, len(f)):
			if f[j] - y > b:
				h = h + 1
				y = f[j - 1]
				j = j - 1
		print(2 + h)


import os
import sys
from math import *
from collections import *
from bisect import *
from io import BytesIO, IOBase

def vsInput():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
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')
ALPHA = 'abcdefghijklmnopqrstuvwxyz'
M = 998244353
EPS = 1e-06

def Ceil(a, b):
	return a // b + int(a % b > 0)

def value():
	return tuple(map(int, input().split()))

def array():
	return [int(i) for i in input().split()]

def Int():
	return int(input())

def Str():
	return input()

def arrayS():
	return [i for i in input().split()]

def A(s):
	last_x = -k
	ans = 0
	for i in range(n):
		if s[i] == '*':
			last = i
		if i - last_x == k:
			ans += 1
			last_x = last
	ans += last_x != len(s) - 1
	return ans
for _ in range(Int()):
	(n, k) = value()
	s = list(input().strip('.'))
	n = len(s)
	print(min(A(s), A(s[::-1])))


import sys
input = sys.stdin.readline
t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	s = list(input().rstrip('\n'))
	cnt = s.count('*')
	ans = 0
	idx = 0
	last = 0
	for i in range(n):
		if s[i] == '*':
			s[i] = 'x'
			idx = i + k
			ans += 1
			break
	for i in range(n - 1, -1, -1):
		if s[i] == '*':
			s[i] = 'x'
			last = i
			ans += 1
			break
	if ans < 2:
		print(ans)
		continue
	while idx < i and ans < cnt:
		if s[idx] == '*':
			s[idx] = 'x'
			idx += k
			ans += 1
		elif s[idx] == 'x':
			idx += k
		else:
			idx -= 1
	print(ans)


from collections import Counter as cc
from copy import deepcopy
import random
from collections import defaultdict as dd
try:
	t = int(input())
	while t:
		(n, k) = map(int, input().split())
		s = list(input())
		ans = 0
		if n == 1:
			if s[0] == '*':
				ans += 1
		else:
			for i in range(n):
				if s[i] == '*':
					s[i] = 'x'
					break
			(cx, cs) = (0, 0)
			flag = 0
			for i in range(n):
				if s[i] == 'x':
					cx = i
					j = min(i + k, n - 1)
					while j > 0 and j < n:
						if s[j] == 'x':
							break
						elif s[j] == '*':
							s[j] = 'x'
							break
						j -= 1
			ca = cc(s)
			cnt = ca['x']
			ans = cnt
		print(ans)
		t -= 1
except EOFError as e:
	pass


t = int(input())
for t1 in range(t):
	(n, k) = map(int, input().split())
	s = list(input())
	counter = k
	ans = 0
	flag = False
	i = 0
	while i < n:
		if s[i] == '*' and (not flag):
			s[i] = 'x'
			ans += 1
			flag = True
		if not flag:
			i += 1
		if flag:
			flag2 = True
			for j in range(min(i + k, n - 1), i, -1):
				if s[j] == '*':
					ans += 1
					s[j] = 'x'
					i = j
					flag2 = False
					break
			if flag2:
				break
	print(ans)


def STR():
	return list(input())

def INT():
	return int(input())

def MAP():
	return map(int, input().split())

def MAP2():
	return map(float, input().split())

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

def STRING():
	return input()
import string
import sys
from heapq import heappop, heappush
from bisect import *
from collections import deque, Counter, defaultdict
from math import *
from itertools import permutations, accumulate
dx = [-1, 1, 0, 0]
dy = [0, 0, 1, -1]
for tt in range(INT()):
	(n, k) = MAP()
	s = STR()
	l = []
	for i in range(n):
		if s[i] == '*':
			l.append(i + 1)
	if len(l) == 1 or len(l) == 2:
		print(len(l))
	else:
		x = l[0]
		cnt = 2
		for i in range(1, len(l)):
			if l[i] - x > k:
				x = l[i - 1]
				cnt += 1
			else:
				continue
		print(cnt)


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	s = input()
	p = list(reversed(s))
	a = [x for x in s]
	b = n - p.index('*') - 1
	m = a.index('*')
	count = 1 if b == m else 2
	i = m
	while i < b - k:
		ans = list(reversed(a[i:i + k + 1]))
		i += k - ans.index('*')
		count += 1
	print(count)


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	s = input()
	li = []
	cnt = 0
	for i in s:
		if i == '*':
			li.append(cnt)
		cnt += 1
	(first, res, stars_length) = (li[0], 1, len(li))
	for i in range(stars_length):
		if i == 0:
			continue
		if li[i] - first > k:
			first = li[i - 1]
			res += 1
	if stars_length > 1:
		res += 1
	print(res)


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	s = input()
	li = s.find('*')
	ri = s.rfind('*')
	s = list(s)[li:ri + 1]
	s[0] = 'x'
	s[-1] = 'x'
	i = 0
	xi = 0
	while i < len(s):
		if i - xi < k:
			i += 1
		else:
			while s[i] == '.':
				i -= 1
			s[i] = 'x'
			xi = i
	print(s.count('x'))


def read_ints():
	return map(int, input().split())

def read_string():
	return input()
(t_n,) = read_ints()
for i_t in range(t_n):
	(n, k) = read_ints()
	s = read_string()
	assert len(s) == n
	stars_indices = [i for (i, ch) in enumerate(s) if ch == '*']
	if n <= 2:
		i_to_replace = stars_indices.copy()
	else:
		i_to_replace = [stars_indices[0]]
		for (i_prev, i_curr) in zip(stars_indices[0:], stars_indices[1:]):
			if i_curr - i_to_replace[-1] > k:
				i_to_replace.append(i_prev)
		if i_to_replace[-1] != stars_indices[-1]:
			i_to_replace.append(stars_indices[-1])
	result = len(i_to_replace)
	print(result)


x = int(input())
for testcase in range(1, x + 1):
	(n, k) = map(int, input().split())
	st = input()
	ans = 0
	index = []
	for i in range(len(st)):
		if st[i] == '*':
			index.append(i)
	if len(index) <= 2:
		print(len(index))
		continue
	start = index[0]
	last = index[-1]
	while start + k < last:
		for i in range(start + k, start, -1):
			if st[i] == '*':
				ans += 1
				start = i
				break
	print(ans + 2)


for ak in range(int(input())):
	(x, y) = map(int, input().split())
	a = list(input())
	count = 1
	current = a.index('*')
	hold = 0
	past = a.index('*')
	a[past] = '.'
	for i in range(x):
		if a[i] == '*':
			hold = i
			if hold - past < y:
				past = past
				current = hold
			elif hold - past > y:
				count += 1
				past = current
				current = hold
			else:
				count += 1
				past = hold
				current = hold
	if past != current:
		count += 1
	print(count)


import sys
import math
t = int(input())

def solve(n, k, x):
	ans = 1
	l = x.index('*')
	r = x.rindex('*')
	i = l
	while i < r:
		substr = x[i:i + k + 1]
		ans = ans + 1
		nexti = i + substr.rindex('*')
		if nexti == i or nexti == r:
			break
		i = nexti
	return ans
for i in range(t):
	s = input()
	w = input()
	[n, m] = [int(x) for x in s.split()]
	print(solve(n, m, w))


t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	s = input()
	ans = []
	j = 0
	while s[j] != '*':
		j += 1
	while j < len(s):
		if s[j] == '*':
			prev = j
			ans.append(j)
			j += k
		if j > len(s) - 1:
			break
		if s[j] == '.':
			while s[j] != '*':
				j -= 1
			if j == prev:
				break
	x = len(s) - 1
	y = ans[-1]
	while x != y:
		if s[x] == '*':
			ans.append(x)
			break
		x -= 1
	print(len(ans))


import os
import sys
from io import BytesIO, IOBase
mod = 10 ** 9 + 7
from bisect import bisect_left

def main():
	for _ in range(int(input())):
		(n, k) = map(int, input().split())
		s = list(input())
		d = dict()
		d['*'] = []
		d['.'] = []
		for i in range(n):
			d[s[i]].append(i + 1)
		lst = list(d['*'])
		ans = 1
		l = 0
		r = 0
		while r + 1 < len(lst):
			if lst[r + 1] - lst[l] <= k:
				r += 1
			else:
				l = r
				ans += 1
		if len(lst) == 1:
			print(ans)
		else:
			print(ans + 1)

def nouse0():
	a = 420
	b = 420
	print(f'i am nitish{(a + b) // 2}')

def nouse1():
	a = 420
	b = 420
	print(f'i am nitish{(a + b) // 2}')

def nouse2():
	a = 420
	b = 420
	print(f'i am nitish{(a + b) // 2}')
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 nouse3():
	a = 420
	b = 420
	print(f'i am nitish{(a + b) // 2}')

def nouse4():
	a = 420
	b = 420
	print(f'i am nitish{(a + b) // 2}')

def nouse5():
	a = 420
	b = 420
	print(f'i am nitish{(a + b) // 2}')
main()


t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	s = input()
	l = list(s)
	flag = 0
	for i in range(n):
		if l[i] == '*':
			if flag == 0:
				flag = 1
				start = i
			end = i
	l[start] = 'x'
	last = start
	c = 1
	while last < end:
		j = 0
		i = last + 1
		m = -1
		while j < k and i < n:
			if l[i] == '*':
				m = i
			j += 1
			i += 1
		last = m
		c += 1
	print(c)


t = int(input())
while t:
	t -= 1
	(n, k) = map(int, input().split())
	s = input()
	i1 = s.find('*')
	s = list(s)
	s[i1] = 'x'
	i = i1 + k
	while i1 < i < len(s):
		if s[i] == '*':
			s[i] = 'x'
			i = i + k
		elif s[i] == 'x':
			break
		else:
			i -= 1
	i = -1
	while True:
		if s[i] == 'x':
			break
		elif s[i] == '.':
			i -= 1
		else:
			s[i] = 'x'
			break
	print(s.count('x'))


import sys
input = lambda : sys.stdin.readline().rstrip()
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	s = input()
	first = 0
	last = n - 1
	S = []
	for el in s:
		if el == '.':
			S.append(0)
		else:
			S.append(1)
	for (idx, el) in enumerate(S):
		if el == 1:
			first = idx
			break
	for i in range(n - 1, -1, -1):
		if S[i] == 1:
			last = i
			break
	S[first] = 2
	S[last] = 2
	here = first
	cnt = 2
	if first == last:
		cnt -= 1
	done = False
	while not done:
		here = min(here, n - k - 1)
		for i in range(here + k, here - 1, -1):
			if S[i] == 1:
				here = i
				S[i] = 2
				cnt += 1
				break
			elif S[i] == 2:
				done = True
				break
	print(cnt)


def solve():
	for i in range(int(input())):
		(m, k) = [int(i) for i in input().split()]
		s = input().strip('.')
		extra = 0
		dist = -1
		c = 1
		for p in range(len(s)):
			if s[p] == '*':
				extra = 0
			else:
				extra += 1
			dist += 1
			if dist == k:
				c += 1
				dist = extra
		if dist != 0:
			c += 1
		print(c)
solve()


t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	s = input().rstrip()
	if s.count('*') == 1:
		print(1)
	else:
		idx1 = idx2 = -1
		for i in range(n):
			if s[i] == '*':
				idx1 = i
				break
		for i in range(n - 1, -1, -1):
			if s[i] == '*':
				idx2 = i
				break
		c = 1
		i = 0
		idx = idx1
		while True:
			idx = s.rfind('*', idx + 1, min(idx + k, n - 1) + 1)
			if idx == -1:
				break
			else:
				c += 1
		print(c)


test_n = int(input())
for _ in range(test_n):
	(n, k) = map(int, input().split(' '))
	string = input()
	ans = 0
	left = string.index('*')
	right = string.rindex('*')
	if left == right:
		print(1)
		continue
	ans += 2
	while True:
		idx = left + k
		if idx >= right:
			print(ans)
			break
		if string[idx] == '.':
			while True:
				idx -= 1
				if string[idx] == '*':
					break
		ans += 1
		if right - idx <= k:
			print(ans)
			break
		left = idx


import math
import sys
input = sys.stdin.readline

def inp():
	return int(input())

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

def insr():
	s = input().strip()
	return list(s[:len(s)])

def invr():
	return map(int, input().split())
for i in range(inp()):
	(n, k) = invr()
	s = insr()
	d = []
	for i in range(n):
		if s[i] == '*':
			d.append(i)
	if len(d) < 2:
		print(len(d))
	elif d[0] + k >= d[-1]:
		print(2)
	else:
		c = 0
		start = d[0]
		end = d[-1]
		while start + k < end:
			for i in range(start + k, start, -1):
				if s[i] == '*':
					start = min(i, end)
					c += 1
					break
		print(c + 2)


def solve():
	(n, k) = map(int, input().split())
	s = list(input())
	i = 0
	while i < n:
		if s[i] == '*':
			s[i] = 'x'
			j = min(i + k, n - 1)
			while s[j] != '*' and j > i:
				j -= 1
			i = j - 1
		i += 1
	return s.count('x')
t = int(input())
while t > 0:
	print(solve())
	t -= 1


for _ in range(int(input())):
	(n, k) = list(map(int, input().split()))
	s = input()
	a = []
	for i in range(len(s)):
		if s[i] == '*':
			a.append(i)
	if len(a) < 3:
		print(len(a))
	else:
		i = 0
		count = 0
		while i < len(a) - 1:
			j = i
			while j < len(a) and a[j] <= a[i] + k:
				j += 1
			count += 1
			i = j - 1
		print(count + 1)


def solve(N, K, S):
	l = []
	for i in range(N):
		if S[i] == '*':
			l.append(i)
	if len(l) == 1:
		ans = 1
	elif len(l) == 2:
		ans = 2
	else:
		ans = 1
		i = 0
		while i < len(l) - 1:
			now = l[i]
			for j in range(K, 0, -1):
				if now + j in l:
					i = l.index(now + j)
					ans += 1
					break
			if i == len(l) - 1:
				break
	return ans
T = int(input())
for i in range(T):
	(N, K) = map(int, input().split())
	S = input()
	print(solve(N, K, S))


T = int(input())
for t in range(T):
	(n, k) = [int(ea) for ea in input().split(' ')]
	s = list(input())
	i = 0
	while True:
		if s[i] == '*':
			s[i] = 'x'
			break
		i += 1
	j = len(s) - 1
	alreadyValid = False
	while True:
		if s[j] == '*':
			s[j] = 'x'
			break
		if s[j] == 'x':
			alreadyValid = True
			break
		j -= 1
	if alreadyValid:
		print(1)
		continue
	xs = 2
	while True:
		i += k
		if i >= j:
			break
		while s[i] != '*':
			i -= 1
		xs += 1
	print(xs)


from collections import defaultdict, OrderedDict, Counter
from sys import stdin, stdout
from bisect import bisect_left, bisect_right
from queue import Queue, PriorityQueue
from heapq import *
from statistics import *
from math import *
import fractions
import copy
from copy import deepcopy
import sys
import io
sys.setrecursionlimit(10000)
import math
import os
import bisect
import collections
mod = pow(10, 9) + 7
import random
from random import *
from time import time

def ncr(n, r, p=mod):
	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 normalncr(n, r):
	r = min(r, n - r)
	count = 1
	for i in range(n - r, n + 1):
		count *= i
	for i in range(1, r + 1):
		count //= i
	return count
inf = float('inf')
adj = defaultdict(set)
visited = defaultdict(int)

def addedge(a, b):
	adj[a].add(b)
	adj[b].add(a)

def bfs(v):
	q = Queue()
	q.put(v)
	visited[v] = 1
	while q.qsize() > 0:
		s = q.get_nowait()
		print(s)
		for i in adj[s]:
			if visited[i] == 0:
				q.put(i)
				visited[i] = 1

def dfs(v, visited):
	if visited[v] == 1:
		return
	visited[v] = 1
	print(v)
	for i in adj[v]:
		dfs(i, visited)

def reverse_bisect_right(a, x, lo=0, hi=None):
	if lo < 0:
		raise ValueError('lo must be non-negative')
	if hi is None:
		hi = len(a)
	while lo < hi:
		mid = (lo + hi) // 2
		if x > a[mid]:
			hi = mid
		else:
			lo = mid + 1
	return lo

def reverse_bisect_left(a, x, lo=0, hi=None):
	if lo < 0:
		raise ValueError('lo must be non-negative')
	if hi is None:
		hi = len(a)
	while lo < hi:
		mid = (lo + hi) // 2
		if x >= a[mid]:
			hi = mid
		else:
			lo = mid + 1
	return lo

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

def get_str_list_in_int():
	return [int(i) for i in list(input())]

def get_str_list():
	return list(input())

def get_map():
	return map(int, input().split())

def input_int():
	return int(input())

def matrix(a, b):
	return [[0 for i in range(b)] for j in range(a)]

def swap(a, b):
	return (b, a)

def find_gcd(l):
	a = l[0]
	for i in range(len(l)):
		a = gcd(a, l[i])
	return a

def is_prime(n):
	sqrta = int(sqrt(n))
	for i in range(2, sqrta + 1):
		if n % i == 0:
			return 0
	return 1

def prime_factors(n):
	while n % 2 == 0:
		return [2] + prime_factors(n // 2)
	sqrta = int(sqrt(n))
	for i in range(3, sqrta + 1, 2):
		if n % i == 0:
			return [i] + prime_factors(n // i)
	return [n]

def p(a):
	if type(a) == str:
		print(a + '\n')
	else:
		print(str(a) + '\n')

def ps(a):
	if type(a) == str:
		print(a)
	else:
		print(str(a))

def kth_no_not_div_by_n(n, k):
	return k + (k - 1) // (n - 1)

def forward_array(l):
	n = len(l)
	stack = []
	forward = [0] * n
	for i in range(len(l) - 1, -1, -1):
		while len(stack) and l[stack[-1]] < l[i]:
			stack.pop()
		if len(stack) == 0:
			forward[i] = len(l)
		else:
			forward[i] = stack[-1]
		stack.append(i)
	return forward

def backward_array(l):
	n = len(l)
	stack = []
	backward = [0] * n
	for i in range(len(l)):
		while len(stack) and l[stack[-1]] < l[i]:
			stack.pop()
		if len(stack) == 0:
			backward[i] = -1
		else:
			backward[i] = stack[-1]
		stack.append(i)
	return backward
nc = 'NO'
yc = 'YES'
ns = 'No'
ys = 'Yes'
for i in range(int(input())):
	(n, k) = get_list()
	a = list(input())
	dict = defaultdict(int)
	for i in range(n):
		if a[i] == '*':
			dict['first'] = i
			break
	for i in reversed(range(n)):
		if a[i] == '*':
			dict['last'] = i
			break
	first = dict['first']
	last = dict['last']
	a[first] = 'x'
	a[last] = 'x'
	if dict['last'] == dict['first']:
		print(1)
		continue
	if dict['last'] - dict['first'] <= k:
		print(2)
		continue
	last_x = first
	while not last - last_x <= k:
		for j in range(last_x + k, last_x, -1):
			if a[j] == '*':
				a[j] = 'x'
				last_x = j
				break
	print(a.count('x'))


import sys
import math
import bisect
from math import sqrt

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

def iinput():
	return int(input())

def rinput():
	return map(int, sys.stdin.readline().strip().split())

def get_list():
	return list(map(int, sys.stdin.readline().strip().split()))
mod = int(1000000000.0) + 7
for _ in range(iinput()):
	(n, k) = rinput()
	s = input()
	(first, last) = (s.index('*'), s.rindex('*'))
	if first == last:
		print(1)
		continue
	ans = 2
	res = s[:first] + 'x' + s[first + 1:last] + 'x' + s[last + 1:]
	i = 0
	ind = first
	while ind < n:
		st = res[ind + 1:ind + k + 1]
		if 'x' in st:
			break
		t = st.rindex('*') + ind + 1
		ans += 1
		ind = t
	print(ans)


import math
from collections import defaultdict
from sys import stdin
T = int(input())
for _ in range(T):
	(n, k) = map(int, input().split())
	s = input()
	l = []
	for i in range(n):
		if s[i] == '*':
			l.append(i)
	if len(l) <= 2:
		print(len(l))
	else:
		c = 2
		lim = len(l)
		low = l[0]
		for i in range(1, lim):
			if l[i] - low > k:
				c += 1
				low = l[i - 1]
		print(c)


from sys import stdin, stdout
from os import path
rd = lambda : stdin.readline().strip()
wr = stdout.write
if path.exists('input.txt'):
	stdin = open('input.txt', 'r')
import time, math
from collections import defaultdict
for _ in range(int(rd())):
	(n, m) = map(int, rd().split())
	x = rd()
	arr = []
	out = 1
	for i in range(len(x)):
		if x[i] == '*':
			arr.append(i)
	j = 0
	for i in range(1, len(arr)):
		if arr[i] - arr[j] < m:
			if i == len(arr) - 1:
				out += 1
			continue
		elif arr[i] - arr[j] > m:
			if arr[i] - arr[i - 1] == m:
				out += 1
				j = i
			else:
				if i == len(arr) - 1:
					out += 1
				j = i - 1
			out += 1
		else:
			out += 1
			j = i
	print(out)


t = int(input())
while t > 0:
	t -= 1
	(n, k) = map(int, input().split(' '))
	l1 = list(input())
	count = 0
	i1 = 0
	i2 = 0
	for i in range(n):
		if l1[i] == '*':
			l1[i] = 'x'
			count += 1
			i1 = i
			break
	for i in range(n - 1, -1, -1):
		if l1[i] == '*':
			l1[i] = 'x'
			count += 1
			i2 = i
			break
	temp = i1
	while temp + k < i2 and temp < n:
		for i in range(temp + k, temp, -1):
			if l1[i] == '*':
				l1[i] = 'x'
				count += 1
				temp = i
				break
	print(count)


__version__ = '0.1'
__date__ = '2021-03-25'
import sys

def solve(n, k, s) -> int:
	for i in range(n):
		if s[i] == '*':
			left = i
			break
	for i in range(n - 1, -1, -1):
		if s[i] == '*':
			right = i
			break
	if left == right:
		return 1
	ans = 2
	curr = left
	while curr + k < right:
		for step in range(k, 0, -1):
			if s[curr + step] == '*':
				curr += step
				ans += 1
				break
	return ans

def main(argv=None):
	t = int(input())
	for _ in range(t):
		(n, k) = map(int, input().split())
		s = input()
		print(solve(n, k, s))
	return 0
STATUS = main()
sys.exit(STATUS)


for test in range(int(input())):
	(n, k) = map(int, input().split())
	s = input()
	r = 0
	i = s.find('*')
	j = i - 1
	while j != i:
		if s[i] == '*':
			r += 1
			j = i
			i = min(i + k, n - 1)
		else:
			i -= 1
	print(r)


import time
t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	s = input()
	ans = 1
	j = s.find('*')
	while True:
		s1 = s[j + 1:j + k + 1]
		length = len(s1)
		for i in range(length):
			if s1[length - i - 1] == '*':
				ans += 1
				j += length - i
				break
		else:
			break
	print(ans)


import sys
import math

def fn(n, k, s):
	c = 0
	s = list(s)
	for i in range(n):
		if s[i] == '*':
			s[i] = 'x'
			c = c + 1
			break
	for i in range(n - 1, -1, -1):
		if s[i] == '*':
			s[i] = 'x'
			c = c + 1
			break
	st = []
	for i in range(n):
		if s[i] == 'x' or s[i] == '*':
			st.append(i)
	if len(st) == 2:
		return 2
	if len(st) == 1:
		return 1
	for i in range(len(st)):
		if s[st[i]] == 'x':
			for j in range(i + 1, len(st)):
				if s[st[j]] == '*':
					if st[j] - st[i] == k:
						s[st[j]] = 'x'
						c = c + 1
						break
					elif st[j] - st[i] > k:
						s[st[j - 1]] = 'x'
						c = c + 1
						break
				if s[st[j]] == 'x' and st[j] - st[i] > k:
					s[st[j - 1]] = 'x'
	c = 0
	for i in range(n):
		if s[i] == 'x':
			c = c + 1
	return c
input = sys.stdin.read()
data = list(map(str, input.split()))
t = int(data[0])
l = 0
for i in range(t):
	n = int(data[l + 1])
	k = int(data[l + 2])
	s = data[l + 3]
	l = l + 3
	print(fn(n, k, s))


def solve():
	(n, k) = map(int, input().split())
	s = list(input())
	arr = []
	for i in range(n):
		if s[i] == '*':
			arr.append(i)
	p = arr[0]
	c = 1
	i = 1
	while i < len(arr):
		if arr[i] - p == k:
			p = arr[i]
			c += 1
			i += 1
		elif arr[i] - p > k:
			p = arr[i - 1]
			c += 1
		else:
			i += 1
	if p != arr[-1]:
		c += 1
	print(c)

def main():
	for _ in range(int(input())):
		solve()
main()


def solve():
	t = int(input().strip())
	for _ in range(t):
		(n, k) = map(int, input().split())
		s = input().strip()
		asterisks = []
		for (i, c) in enumerate(s):
			if c == '*':
				asterisks.append(i)
		used = 1
		last = asterisks[0]
		for i in range(1, len(asterisks)):
			if asterisks[i] - last > k and last != asterisks[i - 1]:
				last = asterisks[i - 1]
				used += 1
		if asterisks[-1] != last:
			used += 1
		print(used)
solve()


for i in range(int(input())):
	nk = input().split()
	n = int(nk[0])
	k = int(nk[1])
	s = input()
	if s.count('*') < 3:
		print(s.count('*'))
	else:
		count = 2
		i = s.index('*')
		s = s[::-1]
		j = s.index('*')
		j = n - 1 - j
		s = s[::-1]
		while i < j - k:
			for x in range(i + k, i, -1):
				if s[x] == '*':
					count += 1
					i = x
					break
		print(count)


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	s = input()
	index = s.find('*')
	c = 1
	last = s.rfind('*')
	while index < last:
		if s[index] == '*':
			index += k
			c += 1
		else:
			index -= 1
	print(c)


def solve():
	(n, k) = map(int, input().split())
	s = input()
	first = 0
	while s[first] != '*':
		first += 1
	last = n - 1
	while s[last] != '*':
		last -= 1
	cnt = 1
	if first != last:
		cnt = 2
	(last_star, prev, next) = (first, first, first)
	while next != last:
		next += 1
		if s[next] == '*':
			if next - prev > k:
				cnt += 1
				prev = last_star
			last_star = next
	print(cnt)
t = int(input())
for _ in range(t):
	solve()


t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	s = input()
	marks = []
	for (i, char) in enumerate(s):
		if char == '*':
			marks.append(i)
	count = 2
	i = 0
	while i < len(marks) - 1:
		j = len(marks) - 1
		while j > i and marks[j] - marks[i] > k:
			j -= 1
		count += 1
		i = j
	print(count - 1)


for p in range(int(input())):
	(a, b) = map(int, input().split())
	k = list(input())
	if k.count('*') == 1:
		print(1)
	elif k.count('*') == 2:
		print(2)
	else:
		l = []
		for i in range(a):
			if k[i] == '*':
				l.append(i)
		r = 2
		if l[-1] - l[0] <= b:
			print(r)
		else:
			(p1, p2, f) = (0, 0, 0)
			while 1:
				while l[p1 + 1] - l[p2] <= b:
					p1 += 1
					if p1 == len(l) - 1:
						f = 1
						break
				(p2, p1) = (p1, p1)
				if f:
					break
				else:
					r += 1
			print(r)


import math
import sys
inf = float('inf')
input = sys.stdin.readline
mod = 10 ** 9 + 7
from collections import Counter
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	arr = list(input())
	ans = 1
	i = arr.index('*')
	flag = True
	while flag:
		j = min(n - 1, i + k)
		while j > i and arr[j] == '.':
			j -= 1
		if i == j:
			break
		ans += 1
		i = j
	print(ans)


for t in range(int(input())):
	(n, k) = map(int, input().split())
	s = input()
	st = s.index('*')
	ans = 1
	while True:
		try:
			st = s[st + 1:st + k + 1].rindex('*') + st + 1
			ans += 1
		except:
			break
	print(ans)


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	s = input()
	start = s.index('*')
	ans = 1
	while True:
		try:
			start = s[start + 1:start + k + 1].rindex('*') + start + 1
			ans += 1
		except:
			break
	print(ans)


import os.path
from math import gcd, floor, ceil
from collections import *
import sys
mod = 1000000007
INF = float('inf')

def st():
	return list(sys.stdin.readline().strip())

def li():
	return list(map(int, sys.stdin.readline().split()))

def mp():
	return map(int, sys.stdin.readline().split())

def inp():
	return int(sys.stdin.readline())

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

def prl(n):
	return sys.stdout.write(str(n) + ' ')
if os.path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')

def solve():
	(n, k) = mp()
	s = st()
	i = s.index('*')
	ans = 1
	while True:
		j = min(i + k, n - 1)
		while j > i and s[j] == '.':
			j -= 1
		if j == i:
			pr(ans)
			return
		ans += 1
		i = j
for _ in range(inp()):
	solve()


t = int(input().strip())

def doOne(s, k):
	nxt = s.index('X')
	if nxt >= k:
		pos = k - 1
		while s[pos] != '*':
			pos -= 1
		return (s[pos + 1:], 1)
	return (s[nxt + 1:], 0)
for _ in range(t):
	(n, k) = map(int, input().strip().split())
	s = input().strip().strip('.')
	if len(s) <= 2:
		print(len(s))
		continue
	s = s[1:len(s) - 1] + 'X'
	ans = 2
	while True:
		(s, a) = doOne(s, k)
		ans += a
		if len(s) == 0:
			break
	print(ans)


t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	S = input()
	arr = []
	m = 0
	for i in range(n):
		if S[i] == '*':
			arr.append(i)
	if len(arr) == 1:
		res = 1
	else:
		res = 2
	for i in range(1, len(arr) - 1):
		if arr[i] - arr[m] == k:
			m = i
			res += 1
		elif arr[i] - arr[m] > k:
			m = i - 1
			res += 1
	if arr[len(arr) - 1] - arr[m] > k:
		res += 1
	print(res)


t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	s = input()
	if s.count('*') == 1:
		print(1)
	elif s.count('*') == 2:
		print(2)
	else:
		x = s.find('*')
		y = s.rfind('*')
		s = s[x + 1:y]
		c = 2
		while '*' in s and len(s) >= k:
			s1 = s[:k]
			x = s1.rfind('*')
			c += 1
			s = s[x + 1:]
		print(c)


t = int(input())
for _ in range(t):
	(l, k) = map(int, input().split())
	s = input()
	start = s.find('*')
	end = s.rfind('*')
	if start == end:
		print('1')
	else:
		ans = 2
		while start < end:
			start += k
			while start < end and s[start] != '*':
				start -= 1
			ans += 1 * (start < end)
		print(ans)


for _ in range(int(input())):
	(n, k) = map(int, input().rstrip().split())
	s = list(input())
	ans = 0
	start = s.index('*')
	scount = s.count('*')
	if scount == 1:
		ans += 1
	if scount == 2:
		ans += 2
	else:
		end = -1
		for i in range(n - 1, -1, -1):
			if s[i] == '*':
				end = i
				break
		j = start
		while j < end:
			ans += 1
			if j + k >= end:
				ans += 1
				break
			for i in range(j + k, j, -1):
				if s[i] == '*':
					j = i
					break
	print(ans)


t = int(input())
for _ in range(t):
	(n, k) = map(int, input().strip().split())
	s = input()
	old = '*'
	new = 'x'
	count = 0
	if s.count('*') >= 1:
		s = new.join(s.rsplit(old, 1))
		count += 1
	if s.count('*') >= 1:
		s = s.replace('*', 'x', 1)
		count += 1
	last_index = s.find('x')
	for i in range(last_index + 1, n):
		if s[i] == '*' and i - last_index > k or (s[i] == 'x' and i - last_index > k):
			j = i - 1
			while True:
				if s[j] == '*':
					last_index = j
					count += 1
					break
				j -= 1
	else:
		print(count)


t = int(input())
for _ in range(t):
	nk = input().split()
	n = int(nk[0])
	k = int(nk[1])
	a = input()
	c = a.index('*')
	b = a.rindex('*')
	cnt = 2
	if c == b:
		print(1)
	else:
		while b - c > k:
			c = a[:c + k + 1].rindex('*')
			cnt += 1
		print(cnt)


t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	s = input()
	var = 1
	ind = s.index('*')
	last = 0
	s = s[0:ind] + 'X' + s[ind + 1:n]
	for p in range(n - 1, -1, -1):
		if s[p] == '*' and ind != p:
			s = s[0:p] + 'X' + s[p + 1:n]
			last = p
			var += 1
			break
	while ind + k < last:
		for j in range(ind + k, ind, -1):
			if s[j] == 'X':
				break
			if s[j] == '*':
				ind = j
				s = s[0:ind] + 'X' + s[ind + 1:n]
				var += 1
				break
	print(var)


t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	s = input()
	s = list(s)
	val = s.count('*')
	if val <= 2:
		print(val)
	else:
		pehla = s.index('*')
		j = pehla
		cnt = 1
		while j < n:
			tmp = min(j + k, n - 1)
			flg = 1
			while tmp > j:
				if s[tmp] == '*':
					j = tmp
					cnt += 1
					flg = 0
					break
				else:
					tmp -= 1
			if flg:
				break
		print(cnt)


t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	s = input()
	arr = []
	for (i, c) in enumerate(s):
		if c == '*':
			arr += [i]
	if len(arr) == 1:
		print(1)
		continue
	res = 1
	prev = arr[0]
	i = 1
	for curr in arr[1:]:
		if curr - prev > k:
			prev = arr[i - 1]
			res += 1
		i += 1
	print(res + 1)


import collections

def process(n, k, s):
	res = 1
	i = s.find('*')
	while True:
		j = min(n - 1, i + k)
		while i < j and s[j] == '.':
			j -= 1
		if i == j:
			break
		res += 1
		i = j
	print(res)
tcs = int(input())
for tc in range(tcs):
	(n, k) = list(map(int, input().split()))
	s = input()
	process(n, k, s)


def answer(st, k):
	(ss, es) = (st.find('*'), st.rfind('*'))
	count = 1
	i = ss
	while i < es:
		if st[i] == '*':
			count += 1
		nextStar = min(len(st) - 1, i + k)
		while st[nextStar] != '*':
			nextStar -= 1
		i = nextStar
	return count
t = int(input())
for _ in range(t):
	(n, k) = tuple(map(int, input().split()))
	st = input()
	print(answer(st, k))


I = input
for _ in range(int(I())):
	(n, k) = map(int, I().split())
	idx = [i for (i, c) in enumerate(I().strip()) if c == '*']
	(res, p) = (1, idx[0])
	for (i, j) in enumerate(idx):
		if j - p > k:
			p = idx[i - 1]
			res += 1
	print(res + 1 if len(idx) > 1 else res)


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	ans = 0
	s = list(input())
	for i in range(n):
		if s[i] == '*':
			a = i
			ans += 1
			break
	b = a
	for j in range(n - 1, a, -1):
		if s[j] == '*':
			b = j
			ans += 1
			break
	ans1 = ans
	i = a
	while i < b:
		if s[i] == '*':
			for j in range(i + k, i, -1):
				if j > n - 1:
					continue
				if s[j] == '*':
					if i != a:
						ans += 1
					i = j
					break
		else:
			i += 1
	i = b
	while i > a:
		if s[i] == '*':
			for j in range(i - k, i):
				if j < 0:
					continue
				if s[j] == '*':
					i = j
					ans1 += 1
					break
		else:
			i -= 1
	print(min(ans1, ans))


for __ in range(int(input())):
	(a, k) = map(int, input().split())
	s = input()
	i = 0
	while s[i] != '*':
		i += 1
	ls = i
	c = 1
	flag = 1
	while i < len(s):
		ii = min(i + k, len(s) - 1)
		for j in range(ii, i - 1, -1):
			if j == i:
				flag = 0
				break
			if s[j] == '*':
				c += 1
				i = j
				break
		if ii == len(s) - 1 or flag == 0:
			break
	print(c)


from sys import stdin, stdout

def sree(shan, k):
	(nR, cR) = (0, 0)
	while cR <= len(shan) - 2:
		lR = cR
		while cR <= len(shan) - 2 and shan[cR + 1] - shan[lR] <= k:
			cR += 1
		if cR == lR:
			return -1
		if cR <= len(shan) - 2:
			nR += 1
	return nR
for _ in range(int(stdin.readline())):
	(n, k) = map(int, stdin.readline().split())
	s = stdin.readline().strip('\n')
	shan = []
	for i in range(n):
		if s[i] != '.':
			shan.append(i)
	if len(shan) == 1:
		print(1)
	else:
		count = 0
		i = 0
		k = sree(shan, k)
		if k == -1:
			print(-1)
		else:
			print(k + 2)


test = int(input())

def convenient(L, n, k):
	T = []
	counter = 0
	for i in range(n):
		if L[i] == '*':
			T.append(i)
	for i in range(len(T) - 1):
		if i == 0:
			last = T[0]
			counter += 1
		elif T[i + 1] - last > k:
			L[T[i]] = 'x'
			counter += 1
			last = T[i]
	return counter + 1
for loop in range(test):
	(n, k) = [int(x) for x in input().split()]
	s = list(input())
	print(convenient(s, n, k))


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	s = str(input())
	p = s.find('*')
	q = s.rfind('*')
	if p == q:
		print(1)
	else:
		ans = 2
		while q - p > k:
			p = s.rfind('*', 0, p + k + 1)
			ans += 1
		print(ans)


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	s = input()
	i = s.find('*')
	ans = 1
	while True:
		j = min(n - 1, i + k)
		while i < j and s[j] == '.':
			j -= 1
		if i == j:
			break
		ans += 1
		i = j
	print(ans)


def zamien(n, k, s):
	wynik = 0
	s = list(s)
	for i in range(n):
		if s[i] == '*':
			s[i] = 'x'
			wynik += 1
			break
	s = s[::-1]
	for i in range(n):
		if s[i] == '*':
			s[i] = 'x'
			wynik += 1
			break
	s = s[::-1]
	ind = []
	gw = []
	for i in range(len(s)):
		if s[i] == 'x':
			ind.append(i)
		elif s[i] == '*':
			gw.append(i)
	for i in range(len(ind) - 1):
		if ind[i + 1] - ind[i] > k:
			a = ind[i]
			b = ind[i + 1]
			tmp = []
			while b - a > k:
				tmp = 0
				for l in gw:
					if l - a <= k:
						tmp = l
					else:
						break
				a = tmp
				wynik += 1
	return wynik

def main():
	for i in range(int(input())):
		(n, k) = input().split()
		print(zamien(int(n), int(k), input()))
main()


for _ in range(int(input())):
	(N, K) = map(int, input().split())
	last = 0
	arr = []
	s = list(input())
	for i in range(N):
		if s[i] == '*':
			last = i
	first = 0
	for i in range(N):
		if s[i] == '*':
			first = i
			break
	(prev, prevch) = (first, -K - 1)
	count = 0
	for i in range(N):
		if s[i] == '*':
			if i - prevch <= K:
				pass
			else:
				prevch = prev
				count += 1
			prev = i
	if last == prevch:
		print(count)
	else:
		print(count + 1)


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	s = list(input().strip('.'))
	dist = 0
	last = -1
	x = 0
	for (i, t) in enumerate(s):
		dist += 1
		if last == -1 and t == '*':
			last = i
			dist = 0
			s[i] = 'x'
			x += 1
		if t == '*':
			last = i
		if dist == k:
			dist = i - last
			s[last] = 'x'
			x += 1
	if s[last] != 'x':
		x += 1
	s[last] = 'x'
	print(x)


T = int(input())
for _ in range(T):
	(l, k) = map(int, input().split())
	first = None
	last = None
	s = list(input())
	for i in range(l):
		if s[i] == '*':
			first = i
			s[i] = 'x'
			break
	for i in reversed(range(l)):
		if s[i] == '*':
			last = i
			s[i] = 'x'
			break
	if first is not None and last is not None:
		while last - first > k:
			for i in range(first + 1, last + 1):
				if s[i] == '*' and i - first <= k:
					new = i
				if i - first > k:
					break
			s[new] = 'x'
			first = new
	print(s.count('x'))


t = int(input())
for q in range(t):
	(n, k) = [int(x) for x in input().split()]
	s = input()
	ans = s.count('*')
	s = s.replace('*', 'x')
	i = 0
	while i < n - 1:
		if s[i] == 'x':
			minus = 0
			for j in range(i + 1, min(i + k + 1, n)):
				if s[j] == 'x':
					ans -= 1
					minus = 1
					i = j
			if minus:
				ans += 1
			else:
				i += 1
		else:
			i += 1
	print(ans)


t = int(input())
for i in range(t):
	count = 0
	a = input().split()
	n = int(a[0])
	k = int(a[1])
	s = str(input())
	q = []
	for j in range(n):
		q.append(s[j])
	for i in range(n):
		if q[i] == '*':
			q[i] = 'x'
			count += 1
			break
	for i in range(n):
		if q[n - i - 1] == '*':
			q[n - i - 1] = 'x'
			count += 1
			break
	for l in range(n):
		if q[l] == 'x':
			try:
				if 'x' not in q[l + 1:l + 1 + k]:
					asdf = 0
					while True:
						for m in range(k):
							if q[l + k - m] == '*':
								q[l + k - m] = 'x'
								count += 1
								break
						break
			except IndexError:
				if 'x' not in q[l + 1:n]:
					asdf = 0
					while asdf == 0:
						for m in range(n - l - 1):
							if q[n - m - 1] == '*':
								q[n - m - 1] = 'x'
								count += 1
								asdf = 1
						asdf = 1
	print(count)


t = int(input())
for _ in range(t):
	(n, k) = (int(s) for s in input().split())
	s = input()
	i = s.find('*')
	res = 1
	while i < n:
		fragment = s[i + 1:i + k + 1]
		if '*' not in fragment:
			break
		fragment = enumerate(fragment)
		mx = max(fragment, key=lambda el: (el[1] == '*', el[0]))
		res += 1
		i = i + mx[0] + 1
	print(res)


for _ in range(int(input())):
	(n, m) = map(int, input().split())
	s = list(input())
	cnt = 0
	for i in range(n):
		if s[i] == '*':
			s[i] = 'x'
			cnt += 1
			break
	for i in range(n - 1, -1, -1):
		if s[i] == '*':
			s[i] = 'x'
			cnt += 1
			break
	for i in range(n - m):
		if s[i] == 'x':
			j = i + 1
			ind = -1
			while j < n and j <= i + m:
				if s[j] == 'x':
					ind = j
				j += 1
			if ind == -1:
				j = i + 1
				while j < n and j <= i + m:
					if s[j] == '*':
						ind = j
					j += 1
				if ind == -1:
					break
				s[ind] = 'x'
				cnt += 1
				i = ind - 1
			else:
				i = ind - 1
	print(cnt)


Tt = int(input())
for ii in range(Tt):
	(n, k) = map(int, input().split())
	s = input()
	c = s.count('*')
	if c == 1:
		print(1)
	elif c == 2:
		print(2)
	else:
		x = s.find('*')
		l = s[::-1]
		y = l.find('*')
		cnt = 2
		n = n - y
		x += k
		while x < n - 1:
			if s[x] == '*':
				cnt += 1
				x += k
			else:
				x -= 1
		print(cnt)


def solve(s, n, k):
	lind = []
	for (i, it) in enumerate(s):
		if it == '*':
			lind.append(i)
	changes = 1
	prev = lind[0]
	i = 0
	while i + 1 < len(lind):
		while i + 1 < len(lind) and lind[i + 1] - prev <= k:
			i += 1
		changes += 1
		prev = lind[i]
	return changes
for case in range(int(input())):
	(n, k) = map(int, input().split())
	s = input()
	ans = solve(s, n, k)
	print(ans)


def solve(k, s):
	firstStar = s.find('*')
	lastStar = len(s) - s[::-1].find('*') - 1
	numstar = 1
	i = firstStar
	while i < lastStar:
		tmpk = min(k, len(s) - i - 1)
		while s[i + tmpk] != '*':
			tmpk -= 1
		i = i + tmpk
		numstar += 1
	return numstar
res = []
count = int(input())
for i in range(count):
	(n, k) = map(int, input().split())
	s = input()
	res.append(solve(k, s))
for i in res:
	print(i)


tests = int(input())
for _ in range(tests):
	(n, k) = [int(x) for x in input().split()]
	s = list(input())
	start = 0
	end = len(s)
	count = 0
	for i in range(len(s)):
		if s[i] == '*':
			s[i] = 'x'
			start = i
			count += 1
			break
	for i2 in range(len(s)):
		i = len(s) - i2 - 1
		if s[i] == '*':
			s[i] = 'x'
			end = i
			count += 1
			break
	if end == len(s):
		end = start
	counter = 0
	while end - start > k:
		for i in range(start + k, start, -1):
			if s[i] == '*':
				s[i] = 'x'
				start = i
				count += 1
				break
	print(count)


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	s = input()
	start = s.index('*')
	end = n - 1 - s[::-1].index('*')
	if start == end:
		print(1)
		continue
	count = 2
	dist = 0
	last = start
	for i in range(start + 1, end):
		dist += 1
		if s[i] == '*':
			last = i
		if dist == k:
			count += 1
			dist = i - last
	print(count)


for _ in range(int(input())):
	(r, c) = list(map(int, input().split()))
	s = input()
	k = 0
	d = 0
	for i in range(r):
		if s[i] == '*':
			k = i
			d += 1
			break
	i = min(k + c, r - 1)
	while i > k:
		if s[i] == '*':
			k = i
			i = min(i + c, r - 1)
			d += 1
		else:
			i -= 1
	print(d)


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	s = input()
	(i, j) = (s.find('*'), s.rfind('*'))
	if i == j:
		print(1)
	else:
		t = 0
		while j - i > k:
			i = s[:i + k + 1].rfind('*')
			t += 1
		print(t + 2)


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	s = input()
	(l, r) = (s.find('*'), s.rfind('*'))
	if l == r:
		print(1)
	else:
		t = 0
		while r - l > k:
			l = s[:l + k + 1].rfind('*')
			t += 1
		print(t + 2)


import collections
import math
t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	s = input()
	pos = [i for i in range(n) if s[i] == '*']
	res = 1
	i = 0
	l = len(pos)
	while i < l:
		j = i
		while j + 1 < l and pos[j + 1] - pos[i] <= k:
			j += 1
		if j == i:
			break
		res += 1
		i = j
	print(res)


import sys
import math
input = sys.stdin.readline

class Problem:

	def __init__(self):
		pass

	def solve(self):
		ans = 1
		(n, k) = map(int, input().split())
		s = input()
		i = -1
		for i in range(n):
			if s[i] == '*':
				break
		while i < n - 1:
			j = min(n - 1, i + k)
			while j > i and s[j] != '*':
				j -= 1
			if j == i:
				break
			ans += 1
			i = j
		print(ans)

def main():
	p = Problem()
	t = int(input())
	while t:
		p.solve()
		t -= 1
main()


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	(s, ans) = (input().strip(), 1)
	i = s.index('*')
	while True:
		j = min(n - 1, i + k)
		while True:
			if i < j and s[j] == '.':
				j -= 1
			else:
				break
		if i == j:
			break
		ans += 1
		i = j
	print(ans)


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	s = input().strip('\n')
	if s.count('*') <= 2:
		print(s.count('*'))
	else:
		ans = 2
		li = list(s)
		ind = li.index('*')
		li[ind] = 'X'
		for i in range(n - 1, -1, -1):
			if li[i] == '*':
				li[i] = 'X'
				break
		li = li[:i + 1]
		n = len(li)
		i = 0
		while i < n:
			if li[i] == 'X':
				j = i + 1
				if i + k >= n:
					i += 1
					break
				f = 0
				ind = i + 1
				while j <= i + k:
					if li[j] == '*':
						ind = j
					if li[j] == 'X':
						f = 1
						break
					j += 1
				if f == 0:
					ans += 1
					li[ind] = 'X'
			i += 1
		print(ans)


from os import path
import sys, time
mod = int(1000000000.0 + 7)
from math import ceil, floor, gcd, log, log2, factorial, sqrt
from collections import defaultdict, Counter, OrderedDict, deque
from itertools import combinations, permutations
from bisect import *
from functools import reduce
from operator import mul
maxx = float('inf')
I = lambda : int(sys.stdin.buffer.readline())
lint = lambda : [int(x) for x in sys.stdin.buffer.readline().split()]
S = lambda : sys.stdin.readline().strip('\n')
grid = lambda r: [lint() for i in range(r)]
localsys = 0
start_time = time.time()
nCr = lambda n, r: reduce(mul, range(n - r + 1, n + 1), 1) // factorial(r)

def ceill(n, x):
	return (n + x - 1) // x
T = 1

def solve():
	(n, k) = map(int, input().split())
	s = input()
	(f, l, ans) = (s.find('*'), s.rfind('*'), 1)
	if f != l:
		ans += 1
	while l - f > k:
		f = s[:f + k + 1].rfind('*')
		ans += 1
	print(ans)

def run():
	if path.exists('input.txt'):
		sys.stdin = open('input.txt', 'r')
		sys.stdout = open('output.txt', 'w')
run()
T = I() if T else 1
for _ in range(T):
	solve()
if localsys:
	print('\n\nTime Elased :', time.time() - start_time, 'seconds')


from math import *

def solve():
	[_, k] = [int(x) for x in input().split(' ')]
	s = input()
	lastChange = s.index('*')
	iterations = 1
	while True:
		try:
			lastChange = s.rindex('*', lastChange + 1, lastChange + k + 1)
			iterations += 1
		except ValueError:
			break
	return iterations
times = int(input())
for i in range(times):
	print(solve())


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

def main():
	(n, k) = map(int, input().split())
	s = input()
	a = [0] * n
	tot = 0
	for i in range(n):
		if s[i] == '*':
			a[i] = 0
			tot += 1
		elif s[i] == '.':
			a[i] = -1
		else:
			a[i] = 1
	if tot == 1:
		print(1)
	elif tot == 2:
		print(2)
	else:
		mini = 2
		for i in range(n - 1, -1, -1):
			if a[i] == 0:
				a[i] = 1
				i2 = i
				break
		for i in range(n):
			if a[i] == 0:
				a[i] = 1
				i1 = i
				break
		for i in range(i1, i2):
			if a[i] == 1:
				flag = False
				for j in range(i + 1, min(i + k, i2) + 1):
					if a[j] == 1:
						flag = True
						break
					elif a[j] == 0:
						pre = j
				if flag == False:
					a[pre] = 1
					mini += 1
		print(mini)
t = int(input())
for i in range(t):
	main()


z = int(input())
for i in range(z):
	(a, b) = list(map(int, input().split()))
	c = input()
	count = 0
	index = c.index('*')
	while index < a:
		count += 1
		for j in range(min(index + b, a - 1), index, -1):
			if c[j] == '*':
				index = j
				break
		else:
			break
	print(count)


t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	s = input()
	s1 = s
	fi = 0
	tot = 0
	count = 0
	for i in range(len(s)):
		if s[i] == '*':
			s = s[0:i] + 'X' + s[i + 1:]
			count += 1
			tot += 1
			fi = i
			break
		else:
			pass
	for i in range(len(s) - 1, -1, -1):
		if s[i] == '*':
			s = s[0:i] + 'X' + s[i + 1:]
			count += 1
			tot += 1
			la = i
			break
	s1 = s
	count1 = count
	if tot <= 1:
		print(count)
	else:
		i = fi
		while i < la:
			if i + k > la or s[i + k] == 'X':
				break
			else:
				pass
			if s[i + k] == '*':
				s = s[0:i + k] + 'X' + s[i + k + 1:]
				count += 1
				i += k
			else:
				for j in range(i + k, i - 1, -1):
					if s[j] == '*':
						s = s[0:j] + 'X' + s[j + 1:]
						count += 1
						i = j
						break
					else:
						pass
		i = la
		while i > fi:
			if i - k < fi or s1[i - k] == 'X':
				break
			if s1[i - k] == '*':
				s1 = s1[0:i - k] + 'X' + s1[i - k + 1:]
				count1 += 1
				i -= k
			else:
				for j in range(i - k, i):
					if s1[j] == '*':
						s1 = s1[0:j] + 'X' + s1[j + 1:]
						count1 += 1
						i = j
						break
					else:
						pass
		print(min(count, count1))


for _ in range(int(input())):
	(n, m) = map(int, input().split())
	s = list(input())
	prev = -1
	last = -1
	c = 0
	ans = 0
	for i in range(n):
		if prev == -1 and s[i] == '*':
			s[i] = 'x'
			prev = i
			ans = ans + 1
			break
	for i in range(n - 1, -1, -1):
		if last == -1 and s[i] == '*':
			s[i] = 'x'
			last = i
			ans = ans + 1
			break
	if prev >= 0 and last >= 0:
		for i in range(prev + 1, last):
			c = c + 1
			if c != m and s[i] == '*':
				prev = i
			if c == m and s[i] == '*':
				prev = i
				c = 0
				ans = ans + 1
			elif c == m and s[i] == '.':
				s[prev] = 'x'
				c = i - prev
				ans = ans + 1
	print(ans)


for _ in range(int(input())):
	(n, k) = map(int, input().split(' '))
	s = input()
	ans = 0
	res = [0] * n
	for i in range(n):
		if s[i] == '*':
			res[i] = 'x'
			break
	i = n - 1
	while i >= 0:
		if s[i] == '*':
			res[i] = 'x'
			break
		i = i - 1
	for i in range(n):
		if res[i] == 'x':
			p = min(n - 1, i + k)
			while p >= i:
				if s[p] == '*':
					res[p] = 'x'
					break
				p = p - 1
	ans = res.count('x')
	print(ans)


import sys
for _ in range(int(sys.stdin.readline())):
	(n, k) = map(int, sys.stdin.readline().split())
	data = list(sys.stdin.readline().rstrip())
	stars = []
	for (idx, item) in enumerate(data):
		if item == '*':
			stars.append(idx)
	if len(stars) == 1:
		print(1)
		continue
	(ans, now) = (1, stars[0])
	for i in range(1, len(stars)):
		if now + k < stars[i]:
			ans += 1
			now = stars[i - 1]
	print(ans if now == stars[-1] else ans + 1)


t = int(input())
for _ in range(t):
	(n, k) = [int(s) for s in input().split(' ')]
	s = input()
	s = list(s)
	ans = 0
	for i in range(len(s)):
		if s[i] == '*':
			s[i] = 'x'
			ans += 1
			break
	for i in range(len(s) - 1, 0, -1):
		if s[i] == '*':
			s[i] = 'x'
			ans += 1
			break
	index = []
	for i in range(len(s)):
		if s[i] == '*':
			index.append(i)
		elif s[i] == 'x':
			index.append(i)
	st = index[0]
	lst = st
	for i in range(1, len(index)):
		if index[i] - st <= k:
			lst = index[i]
		else:
			ans += 1
			st = lst
			lst = index[i]
	print(ans)


import queue
import math
import sys
from collections import deque
t = int(input())
for _ in range(t):
	X = input().split(' ')
	(n, k) = [int(ai) for ai in X]
	s = list(input())
	s = s + ['y'] * 2 * k
	min_ = 0
	for j in reversed(range(n)):
		if s[j] == '*':
			min_ += 1
			s[j] = 'x'
			break
	idx = 0
	while idx < n:
		if s[idx] == '*':
			s[idx] = 'x'
			min_ += 1
			best_idx = idx + k
			while s[best_idx] == '.' and best_idx > idx + 1:
				best_idx -= 1
			idx = best_idx
		else:
			idx += 1
	print(min_)


t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	s = input()
	arr = [v for v in s]
	i = s.index('*')
	l = s.rindex('*')
	arr[i] = arr[l] = 'x'
	(c, lastidx) = (0, i)
	for j in range(i + 1, l):
		c += 1
		if arr[j] == '*':
			lastidx = j
		if c == k:
			if arr[j] == '*':
				arr[j] = 'x'
				c = 0
			else:
				arr[lastidx] = 'x'
				c = j - lastidx
	print(arr.count('x'))


def solve(s, n, k):
	ans = 0
	prev = 0
	stars = []
	for i in range(n):
		if s[i] == '*':
			stars.append(i)
	ans = 1
	prev = stars[0]
	for i in range(1, len(stars)):
		if stars[i] > prev + k:
			ans = ans + 1
			prev = stars[i - 1]
	if len(stars) > 1:
		ans = ans + 1
	return ans
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	s = input()
	print(solve(s, n, k))


t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	s = input()
	index = s.find('*')
	num = 1
	last = s.rfind('*')
	while index < last:
		if s[index] == '*':
			index += k
			num += 1
		else:
			index -= 1
	print(num)


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

def tupin():
	return tuple(map(int, input().split()))

def intin():
	return int(input())
for t in range(0, intin()):
	(n, k) = tupin()
	s = input()
	l = s.find('*')
	r = s.rfind('*')
	i = l
	count = 1
	while i < r:
		j = i + 1
		while j - i <= k and j <= r:
			if s[j] == '*':
				temp = j
			j += 1
		i = temp
		count += 1
	print(count)


import sys, math, itertools
from collections import Counter, deque, defaultdict
from bisect import bisect_left, bisect_right
from heapq import heappop, heappush, heapify
from copy import deepcopy
mod = 10 ** 9 + 7
INF = float('inf')

def inp():
	return int(sys.stdin.readline())

def inpl():
	return list(map(int, sys.stdin.readline().split()))

def inpl_1():
	return list(map(lambda x: int(x) - 1, sys.stdin.readline().split()))

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

def inpsl(x):
	tmp = sys.stdin.readline()
	return list(tmp[:x])

def err(x):
	print(x)
	exit()
for _ in range(inp()):
	(n, k) = inpl()
	s = inpsl(n)
	if s.count('*') == 1:
		print(1)
		continue
	fir = -1
	for i in range(n):
		if s[i] == '*':
			s[i] = 'x'
			fir = i
			break
	las = -1
	for i in range(n)[::-1]:
		if s[i] == '*':
			s[i] = 'x'
			las = i
			break
	ans = 2
	for i in range(fir, las):
		if s[i] != 'x':
			continue
		for j in range(i + k, i, -1):
			if j >= las:
				break
			if s[j] == '*':
				s[j] = 'x'
				ans += 1
				break
	print(ans)


import math

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

def solve():
	(n, k) = get_inp()
	s = input()
	i = 0
	cnt = 0
	while i < len(s):
		j = i
		if s[i] == '*':
			cnt += 1
			j = min(i + k, len(s) - 1)
			while j > i:
				if s[j] == '*':
					i = j - 1
					break
				j -= 1
		i += 1
	return cnt
tc = int(input())
for _ in range(tc):
	print(solve())


def find_cell(pat, m):
	pass
	first = False
	count = 0
	i = 0
	while i < len(pat):
		if pat[i] == '*':
			count += 1
			k = i + 1
			l = -1
			while k < len(pat) and k - i <= m:
				if pat[k] == '*':
					l = k
				k += 1
			if l != -1:
				i = l
			else:
				break
		else:
			i += 1
	return count
s = int(input())
q = []
for i in range(s):
	sub_q = [int(l) for l in input().strip().split()]
	pat = input().strip()
	print(find_cell(pat, sub_q[1]))


t = int(input())
for test in range(t):
	(n, k) = map(int, input().split())
	s = input()
	x = s.count('*')
	if x == 1:
		print(1)
	elif x == 2:
		print(2)
	else:
		a = s.find('*')
		c = 1
		l = s[::-1]
		b = l.find('*')
		c = 2
		n = n - b - 1
		a += k
		while a < n:
			if s[a] == '*':
				c += 1
				a = a + k
			else:
				a -= 1
		print(c)


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	s = str(input())
	firstOccurence = s.find('*')
	lastOccurence = n - s[::-1].find('*') - 1
	s = list(s)
	cnt = 1
	while firstOccurence < lastOccurence:
		if s[firstOccurence] == '*':
			firstOccurence += k
			cnt += 1
		else:
			firstOccurence -= 1
	print(cnt)


from math import ceil, floor, log
import sys, threading
from heapq import heappush, heappop
from collections import Counter, defaultdict, deque
from bisect import bisect_left, bisect_right
input = lambda : sys.stdin.readline().strip()

def main():
	for _ in range(int(input())):
		(n, k) = list(map(int, input().split()))
		s = list(input())
		l = []
		for i in range(n):
			if s[i] == '*':
				l.append(i)
		ans = 1
		(i, j) = (0, 0)
		s = set([j])
		while j < len(l) - 1:
			i = bisect_right(l, l[j] + k)
			j = i - 1
			s.add(j)
		s.add(len(l) - 1)
		print(len(s))
main()


import sys
import math
from math import factorial, inf, gcd
from heapq import *
from functools import *
from itertools import *
from collections import *
from typing import *
sys.setrecursionlimit(10 ** 5)
t = 1
t = int(input())
for ii in range(t):
	(n, k) = (int(i) for i in input().split())
	s = input()
	r = n - 1
	while r >= 0 and s[r] != '*':
		r -= 1
	if r < 0:
		print(0)
		continue
	i = 0
	ans = 0
	while i < r:
		if s[i] != '*':
			i += 1
		else:
			ans += 1
			j = min(r, i + k)
			while j > i and s[j] != '*':
				j -= 1
			if j > i:
				i = j
	print(ans + 1)


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	s = input()
	last = -1
	prev = 99999999999
	ans = 0
	for (i, symb) in enumerate(s):
		if symb == '*':
			if prev == 99999999999:
				prev = i
				ans += 1
			last = i
		if i - prev >= k and prev != last:
			prev = last
			ans += 1
	if last != prev:
		ans += 1
	print(ans)


import sys, os, io
import math, bisect, operator
(inf, mod) = (float('inf'), 10 ** 9 + 7)
from itertools import groupby, accumulate
from heapq import heapify, heappop, heappush
from collections import deque, Counter, defaultdict
input = iter(sys.stdin.buffer.read().decode().splitlines()).__next__
Neo = lambda : list(map(int, input().split()))
(test,) = Neo()
for i in range(test):
	(n, k) = Neo()
	s = input()
	(Ans1, Ans2) = (0, 0)
	for i in range(n):
		if s[i] == '*':
			Ans1 += 1
			Ans2 += 1
			break
	for j in range(n - 1, -1, -1):
		if s[j] == '*' and j > i:
			Ans1 += 1
			Ans2 += 1
			break
	while i + k < j:
		t = i + k
		while t > i:
			if s[t] == '*':
				Ans1 += 1
				break
			t -= 1
		if i == t:
			break
		i = t
	print(Ans1)


from sys import stdin
N = int(input())
for t in range(N):
	(n, k) = list(map(int, input().split()))
	s = input()
	first = s.find('*')
	if first == -1:
		print(-1)
	else:
		last = s.rfind('*')
		if first == last:
			print(1)
		else:
			count = 2
			j = first
			while True:
				if last - j <= k:
					break
				j += k
				count += 1
				while s[j] != '*':
					j -= 1
			print(count)


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	s = str(input())
	i = 0
	j = -1
	if s.count('*') < 3:
		print(s.count('*'))
	else:
		while i < n:
			if s[i] == '*':
				break
			i += 1
		while j >= -n:
			if s[j] == '*':
				break
			j -= 1
		g = i
		sc = 2
		while 1 > 0:
			if g >= n + j - k:
				break
			f = s[g + 1:g + k + 1]
			o = -1
			while o >= -k:
				if f[o] == '*':
					sc += 1
					g = g + k + o + 1
					break
				o -= 1
		print(sc)


for test_case in range(int(input())):
	(n, k) = map(int, input().split())
	s = input()
	c = 1
	f = s.find('*')
	for i in range(n):
		if f + k < n and s[f + k] == '*':
			c += 1
			f = f + k
		else:
			t = f + k
			if t >= n:
				t = n - 1
			for j in range(t, f, -1):
				if s[j] == '*':
					c += 1
					f = j
					break
	print(c)


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	s = input()
	f = s.find('*')
	l = s.rfind('*')
	if f == l:
		print(1)
	else:
		c = 2
		f1 = 0
		while l - f > k:
			f1 = s[:f + k + 1].rfind('*')
			if f1 == f:
				break
			else:
				f = f1
				c += 1
		print(c)


t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	s = input()
	s = [str(i) for i in s]
	(x, c) = (0, 0)
	for i in range(n):
		if s[i] == '*':
			if c == 0:
				s[i] = 'X'
				c = c + 1
				x = i
			elif i - x == k:
				s[i] = 'X'
				x = i
				c = c + 1
			elif i == n - 1:
				s[i] = 'X'
				x = i
				c = c + 1
		elif s[i] == '.' and (i - x == k or i == n - 1):
			for i in range(i - 1, x, -1):
				if s[i] == '*':
					s[i] = 'X'
					x = i
					c = c + 1
					break
	print(c)


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	a = input()
	cnt = 0
	prev = -1
	pprev = -1
	for i in range(n):
		if a[i] == '*' and (not cnt):
			cnt += 1
			pprev = i
			prev = i
		elif a[i] == '*':
			if i - pprev > k:
				cnt += 1
				pprev = prev
			prev = i
	if a.rfind('*') != pprev:
		cnt += 1
	print(cnt)


t = int(input())
for g in range(t):
	(n, k) = map(int, input().split())
	s = input()
	c = 0
	for i in range(n):
		if s[i] == '*':
			break
	for j in range(n - 1, -1, -1):
		if s[j] == '*':
			break
	if i == j:
		print('1')
	elif i != j:
		c += 2
		p = i
		while p < j:
			if p + k < j and s[p + k] == '*':
				c += 1
				p += k
			elif p + k < j:
				x = p + k
				while x > p:
					if s[x] == '*':
						p = x
						c += 1
						break
					x -= 1
			else:
				break
		print(c)


T = int(input())
for x in range(T):
	a = [int(y) for y in input().split()]
	n = a[0]
	k = a[1]
	s = input()
	l = len(s)
	ans = 1
	p = s.index('*')
	i = l - 1 - s[::-1].index('*')
	while p != i:
		q = min(p + k, l - 1)
		for z in range(q, p - 1, -1):
			if s[z] == '*':
				p = z
				ans = ans + 1
				break
	print(ans)


for _ in range(int(input())):
	(N, K) = map(int, input().split())
	L = input()
	count = 1
	stars = []
	for i in range(N):
		if L[i] == '*':
			stars += [i]
	last = stars[0]
	for i in range(2, len(stars)):
		if stars[i] - last > K:
			count += 1
			last = stars[i - 1]
	if len(stars) > 1:
		count += 1
	print(count)


from collections import deque
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	s = input()
	queue = deque()
	front = -1
	back = -1
	for i in range(n - 1, -1, -1):
		if s[i] == '*':
			back = i
			break
	for i in range(n):
		if s[i] == '*':
			front = i
			break
	if front == back:
		print(1)
		continue
	ans = 2
	dis = 0
	temp = -1
	for i in range(front + 1, back, 1):
		if s[i] == '*':
			dis += 1
			if dis < k:
				temp = i
			elif dis == k:
				temp = -1
				ans += 1
				dis = 0
		else:
			dis += 1
			if dis == k:
				ans += 1
				dis = i - temp
				temp = -1
	ans2 = 2
	dis = 0
	temp = -1
	for i in range(back - 1, front, -1):
		if s[i] == '*':
			dis += 1
			if dis < k:
				temp = i
			elif dis == k:
				temp = -1
				ans2 += 1
				dis = 0
		else:
			dis += 1
			if dis == k:
				ans2 += 1
				dis = abs(i - temp)
				temp = -1
	print(min(ans, ans2))


for z in range(int(input())):
	(n, k) = list(map(int, input().split()))
	s = input()
	a = []
	a1 = 0
	for i in range(n):
		if s[i] == '*':
			a.append(i)
			a1 += 1
	b = 1
	if a1 > 1:
		b += 1
		c = 0
		for i in range(1, a1):
			if a[i] - a[c] > k:
				b += 1
				c = i - 1
	print(b)


t = int(input())
for test in range(t):
	(n, k) = map(int, input().split())
	s = input()
	(l, r) = (s.index('*'), s.rindex('*'))
	if l == r:
		print(1)
	else:
		t = 2
		while r - l > k:
			l = s[:l + k + 1].rfind('*')
			t += 1
		print(t)


t = int(input())
for tt in range(t):
	(n, k) = map(int, input().split())
	s = input()
	l = 0
	while s[l] != '*':
		l += 1
	r = n - 1
	while s[r] != '*':
		r -= 1
	if l == r:
		print(1)
	else:
		ans = 2
		i = l
		while i < r:
			i += k
			while i < r and s[i] != '*':
				i -= 1
			ans += 1 * (i < r)
		print(ans)


import math
import sys
from collections import *
import itertools

def cint():
	return list(map(int, sys.stdin.readline().strip().split()))

def cstr():
	return list(map(str, input().split(' ')))

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

def solve(t):
	(n, k) = cint()
	lst = [i for i in input()]
	counter = 0
	sindx = -1
	eindx = -1
	for i in range(n):
		if lst[i] == '*':
			lst[i] = 'x'
			counter += 1
			sindx = i
			break
	for i in range(n - 1, -1, -1):
		if lst[i] == '*':
			lst[i] = 'x'
			counter += 1
			eindx = i
			break
	indx = sindx
	stars = []
	for i in range(sindx + 1, n):
		if lst[i] == '*':
			if i - indx < k:
				stars.append(i)
			elif i - indx == k:
				lst[i] = 'x'
				indx = i
				counter += 1
			else:
				for j in range(len(stars) - 1, -1, -1):
					tindx = stars[j]
					if tindx != -1:
						if tindx - indx <= k:
							lst[tindx] = 'x'
							stars[j] = -1
							indx = tindx
							counter += 1
							break
				stars.append(i)
	for i in range(eindx - 1, -1, -1):
		if lst[i] == 'x':
			if abs(eindx - i) > k:
				counter += 1
			break
	print(counter)
t = int(input())
for i in range(1, t + 1):
	solve(i)


def p(s, i, n, k):
	if i == n - 1:
		return 1
	nxt = 0
	for j in range(k, 0, -1):
		if j + i < n:
			if s[j + i] == '*':
				nxt = j + i
				break
	return p(s, nxt, n, k) + 1
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	s = input().strip('.')
	print(p(s, 0, len(s), k))


t = int(input())
for test in range(t):
	(n, k) = map(int, input().split())
	s = input()
	arr = []
	start = 0
	end = 0
	for i in range(n):
		if s[i] == '*':
			arr.append(i)
	count = 1
	start = arr[0]
	arr.pop(0)
	i = 0
	while True:
		if i == len(arr):
			break
		if arr[i] - start == k:
			count += 1
			start = arr[i]
			i += 1
		elif arr[i] - start > k:
			count += 1
			start = arr[i - 1]
		else:
			if i == len(arr) - 1:
				count += 1
			i += 1
	print(count)


In = input
lin = lambda : map(int, In().split())
for _ in range(int(In())):
	(_, k) = lin()
	m = In()
	j = 1
	i = m.index('*')
	while i < m.rfind('*'):
		i = m.rfind('*', i, i + k + 1)
		j += 1
	print(j)


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	w = input()[:-1]
	(i, j, c, d) = (w.index('*'), w.rindex('*'), 0, 0)
	while True:
		if w[i] == '*':
			i += k
			c += 1
			d = 0
			if i >= n:
				c += i - k != j
				break
		else:
			i -= 1
			d += 1
			if d == k:
				break
	print(c)


def partial(n, k, s):
	first = 0
	last = n - 1
	for i in range(n):
		if s[i] == '*':
			first = i
			break
	for i in range(n - 1, -1, -1):
		if s[i] == '*':
			last = i
			break
	if first == last:
		count = 1
	else:
		count = 2
	while first + k < last:
		for i in range(first + k, first, -1):
			if i < n and s[i] == s[first]:
				first = i
				count += 1
				break
	print(count)
tc = int(input().strip())
for t in range(tc):
	(n, k) = list(map(int, input().strip().split()))
	s = input()
	partial(n, k, s)


t = int(input())
for i in range(t):
	(n, k) = [int(a) for a in input().split()]
	s = [o for o in input()]
	lp = None
	rp = None
	if s.count('*') == 1 or s.count('*') == 0:
		print(s.count('*'))
		continue
	for l in range(len(s)):
		if s[l] == '*':
			s[l] = 'x'
			lp = l
			break
	for r in range(len(s) - 1, -1, -1):
		if s[r] == '*':
			s[r] = 'x'
			rp = r
			break
	while True:
		if rp - lp <= k:
			break
		for m in range(k, 0, -1):
			if s[lp + m] == '*':
				lp += m
				s[lp] = 'x'
				break
		if rp - lp <= k:
			break
		for n in range(k, 0, -1):
			if s[rp - n] == '*':
				rp -= n
				s[rp] = 'x'
				break
		if rp - lp <= k:
			break
	print(s.count('x'))


def main():
	t = int(input())
	for _ in range(t):
		(n, k) = map(int, input().split())
		s = list(input())
		i = 0
		while i < n:
			if s[i] == '*':
				s[i] = 'x'
				for j in range(k, 0, -1):
					try:
						if s[i + j] == '*':
							i += j
							break
					except IndexError:
						continue
			else:
				i += 1
		print(s.count('x'))
main()


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	l = list(input().strip())
	a = l.index('*')
	b = n - 1 - l[::-1].index('*')
	l[a] = 'x'
	l[b] = 'x'
	i = a
	while True:
		t = 0
		for j in range(k, 0, -1):
			if i + j < n:
				if l[i + j] != '.':
					l[i + j] = 'x'
					t = 1
					i = i + j
					break
		if t == 0:
			break
	print(l.count('x'))


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	s = input()
	ar = []
	for i in range(len(s)):
		if s[i] == '*':
			ar.append(i)
	ans = 2
	prev = ar[0]
	for i in range(1, len(ar)):
		if ar[i] - prev > k:
			prev = ar[i - 1]
			ans += 1
	if len(ar) == 1:
		ans = 1
	print(ans)


def ass(a, b):
	print(f'Assertion error: {a} != {b}' if a != b else 'OK')

def nr():
	return int(input())

def nrs():
	return [int(i) for i in input().split()]

def nrss(n):
	return [nrs() for _ in range(n)]

def word():
	return input()

def words():
	return [w for w in input().split()]

def f(k, s):
	first = s.index('*')
	last = s.rindex('*')
	arr = list(s)
	arr[first] = 'x'
	antal = 1
	if first == last:
		return antal
	arr[last] = 'x'
	antal += 1
	i = first
	while i < len(arr) - 1:
		for j in range(i + k, i, -1):
			if j < len(arr):
				if arr[j] == '*':
					arr[j] = 'x'
					antal += 1
					i = j
					break
				elif arr[j] == 'x':
					return antal
			else:
				return antal
	return antal
for t in range(nr()):
	(_, k) = nrs()
	w = word()
	print(f(k, w))


test = int(input())
while test > 0:
	test -= 1
	(n, k) = map(int, input().split())
	s = input()
	i = 0
	while i < len(s) and s[i] != '*':
		i += 1
	j = len(s) - 1
	while j >= 0 and s[j] != '*':
		j -= 1
	ans = 1
	p = i
	q = i
	t = q
	while q < len(s) and q < j:
		if s[q] == '*':
			t = q
		if q - p == k:
			p = t
			ans += 1
		q += 1
	if j > i:
		ans += 1
	print(ans)


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	s = input()
	if s.count('*') == 0:
		print(0)
		continue
	elif s.count('*') == 1:
		print(1)
		continue
	else:
		val = k - 1
		ans = 2
		s1 = s[s.index('*') + 1:len(s) - s[::-1].index('*') - 1]
		for i in range(len(s1)):
			if s1[i] == '.':
				if val > 0:
					val -= 1
				else:
					val = k - 1 - (i - index)
					ans += 1
			elif s1[i] == '*':
				index = i
				if val == 0:
					val = k - 1
					ans += 1
				else:
					val -= 1
		print(ans)


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

def li():
	return [int(i) for i in input().split()]
for t in range(ii()):
	(n, k) = li()
	s = input()
	prev = -1
	last = -1
	for i in range(n):
		if s[i] == '*':
			prev = i
			break
	for i in range(n - 1, -1, -1):
		if s[i] == '*':
			last = i
			break
	total = 1
	if last != prev:
		total = 2
	cnt = 0
	index = prev
	while index + k < last:
		for i in range(index + k, index, -1):
			if s[i] == '*':
				total += 1
				index = i
				break
	print(total)


import sys
import math
from math import gcd, inf, sqrt, pi, cos, sin, ceil, log2, floor, log
from sys import stdin, stdout, setrecursionlimit
setrecursionlimit(2 ** 20)
N = 20005
prime = [1] * N
for i in range(2, N):
	if prime[i]:
		j = i * i
		while j < N:
			prime[j] = 0
			j += i
T = 1
T = int(stdin.readline())
for _ in range(T):
	(n, k) = list(map(int, stdin.readline().rstrip().split()))
	s = list(stdin.readline().strip('\n'))
	ix = []
	for i in range(n):
		if s[i] == '*':
			ix.append(i)
	if len(ix) <= 1:
		print(len(ix))
		continue
	st = 0
	cnt = 2
	i = 0
	while i < len(ix):
		if ix[i] - ix[st] > k:
			st = i - 1
			cnt += 1
		else:
			i += 1
	print(cnt)


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	s = input()
	(left, right) = (s.find('*'), s.rfind('*'))
	if left == right:
		print(1)
	else:
		count = 2
		while right - left > k:
			left = s[:left + k + 1].rfind('*')
			count += 1
		print(count)


def helper(s, k, x, si):
	if si:
		for i in range(x - k, x):
			if s[i] == '*':
				return i
	else:
		for i in range(x + k, x, -1):
			if s[i] == '*':
				return i

def hel(s, k):
	n = len(s)
	c = 0
	for i in range(n):
		if s[i] == '*':
			c += 1
	if c == 1:
		return 1
	for i in range(n):
		if s[i] == '*':
			break
	stt = i
	for i in range(n - 1, -1, -1):
		if s[i] == '*':
			break
	end = i
	ans = 2
	if end - stt <= k:
		return 2
	while end - stt > k:
		stt = helper(s, k, stt, False)
		end = helper(s, k, end, True)
		if end <= stt:
			return ans + 1
		elif end - stt <= k:
			return ans + 2
		else:
			ans += 2
t = int(input())
for i in range(t):
	arr = list(map(int, input().split()))
	n = arr[0]
	k = arr[1]
	s = input()
	print(hel(s, k))


def answer():
	for i in range(n):
		if s[i] == '*':
			start = i
			break
	for i in range(n - 1, -1, -1):
		if s[i] == '*':
			stop = i + 1
			break
	(ans1, dist) = (2, start)
	for i in range(start, stop):
		if s[i] == '*':
			if i - dist > k:
				ans1 += 1
				dist = far
			far = i
	if dist == stop - 1:
		ans1 -= 1
	(ans2, dist) = (2, stop)
	for i in range(stop - 1, start - 1, -1):
		if s[i] == '*':
			if dist - i > k:
				ans2 += 1
				dist = far
			far = i
	if dist == start:
		ans2 -= 1
	return min(ans1, ans2)
for T in range(int(input())):
	(n, k) = map(int, input().split())
	s = input()
	print(answer())


for q_ in range(int(input())):
	(n, k) = map(int, input().split())
	s = input()
	res = 1
	i = s.find('*') + 1
	while True:
		f = s[i:i + k].rfind('*')
		if f == -1:
			break
		i = i + f + 1
		res += 1
	print(res)


import sys

def answer(n, k, s):
	ans = 0
	sl = list(s)
	if sl.count('*') == 1:
		return 1
	ans = 2
	i1 = sl.index('*')
	sl[i1] = 'x'
	sl.reverse()
	i2 = sl.index('*')
	sl[i2] = 'x'
	sl.reverse()
	i2 = n - 1 - i2
	lsi = -1
	lxi = i1
	for i in range(i1 + 1, i2, 1):
		if sl[i] == '*':
			lsi = i
		if i - lxi >= k:
			sl[lsi] = 'x'
			lxi = lsi
			ans += 1
	return ans

def main():
	t = int(input())
	n = [0] * t
	k = [0] * t
	s = [0] * t
	for j in range(t):
		(n[j], k[j]) = [int(i) for i in sys.stdin.readline().split()]
		s[j] = input()
	for j in range(t):
		print(answer(n[j], k[j], s[j]))
	return
main()


def solve(n, k, s):
	i = 0
	res = 0
	while i < n:
		if s[i] == '*':
			res += 1
			if i == n - 1:
				return res
			j = min(n - 1, i + k)
			while s[j] != '*':
				j -= 1
			i = j + (1 if i == j else 0)
		else:
			i += 1
	return res
T = int(input())
for case in range(T):
	(N, K) = map(int, input().split())
	S = input()
	res = solve(N, K, S)
	print(res)


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	s = input()
	li = []
	f = 0
	c = 0
	for i in range(n):
		if s[i] == '*' and f == 0:
			f = 1
			li.append('x')
			y = i
		else:
			li.append(s[i])
	for i in range(n):
		if li[n - 1 - i] == '*':
			li[n - 1 - i] = 'x'
			y = n - 1 - i
			break
	f = 0
	for i in range(n):
		if i == y:
			break
		if li[i] == 'x':
			f = 0
			for j in range(i + 1, i + k + 1):
				if li[j] == 'x':
					f = 1
					break
				if li[j] == '*':
					z = j
			if f == 0:
				li[z] = 'x'
	for i in range(n):
		if li[i] == 'x':
			c = c + 1
	print(c)


from collections import defaultdict

def func():
	n = int(input())
	for _ in range(n):
		(a, b) = map(int, input().split())
		s = input()
		l = []
		for i in range(a):
			if s[i] == '*':
				l.append(i)
		k = 1
		base = l[0]
		last = l[0]
		for i in l:
			if i - base > b:
				k += 1
				base = last
			last = i
		if base == l[-1]:
			print(k)
		else:
			print(k + 1)
func()


import sys
N = int(200000.0 + 5)
sys.setrecursionlimit(N)

def charming():
	(n, k) = map(int, input().split())
	s = input()
	pos = list()
	for i in range(len(s)):
		if s[i] == '*':
			pos.append(i)
	res = 0
	last = pos[0]
	i = 1
	if len(pos) <= 1:
		print(1)
		return
	while True:
		j = i
		while j < len(pos) and pos[j] - last <= k:
			j += 1
		if j == len(pos):
			break
		res += 1
		i = j
		last = pos[j - 1]
	print(res + 2)
for t in range(int(input())):
	charming()


def fun(ls, ms):
	(n, k) = ms
	min_index = None
	star = '*'
	ans = 1
	for (i, val) in enumerate(ls):
		if val == star:
			min_index = i
			break
	while True:
		j = min(n - 1, i + k)
		while i < j and ls[j] == '.':
			j -= 1
		if i == j:
			break
		i = j
		ans += 1
	print(ans)
T = int(input())
for i in range(T):
	ms = list(map(int, input().split()))
	st = input()
	fun(st, ms)


tests = int(input())
sol = []
while tests:
	tests -= 1
	(n, k) = (int(i) for i in input().split())
	s = [i for i in input()]
	changes = 0
	i = 0
	j = 0
	lst = 0
	while i < n:
		if s[i] == 'x':
			break
		elif s[i] == '*':
			s[i] = 'x'
			changes += 1
			j = i
			break
		i += 1
	i = n - 1
	while i >= 0:
		if s[i] == 'x':
			break
		elif s[i] == '*':
			s[i] = 'x'
			lst = i
			changes += 1
			break
		i -= 1
	while j < lst:
		for i in range(j + k, j, -1):
			if i >= lst:
				j += k
				break
			if s[i] == '*':
				s[i] = 'x'
				changes += 1
				j = i
				break
		else:
			j += k
	sol.append(changes)
print(*sol, sep='\n')


import sys
tc = int(sys.stdin.readline().rstrip())
for _ in range(tc):
	(n, k) = map(int, sys.stdin.readline().split())
	s = sys.stdin.readline().rstrip()
	start = s.find('*')
	end = s.rfind('*')
	s = list(s)
	s[start] = s[end] = 'x'
	cnt = 0
	if start != end:
		cnt = 2
	if start == end:
		cnt = 1
	while start < end:
		star = 0
		dist = start + k + 1
		flag = True
		for i in range(start + 1, min(n, dist)):
			if s[i] == '*':
				star = i
			if s[i] == 'x':
				flag = False
		if star and flag:
			s[star] = 'x'
			start = star
			cnt += 1
		else:
			start = i
	print(cnt)


def replace(n, k, s):
	ind = []
	count = 1
	j = 0
	for i in range(n):
		if s[i] == '*':
			ind.append(i)
	while j <= len(ind) - 1:
		i = j + 1
		while i < len(ind) and ind[i] - ind[j] <= k:
			i = i + 1
		if i >= len(ind):
			j = i
		else:
			j = i - 1
		count = count + 1
	if len(ind) == 1:
		return count - 1
	else:
		return count
x = int(input())
m = []
for i in range(x):
	y = input()
	y1 = y.split(' ')
	y2 = [int(t) for t in y1]
	z = input()
	m.append((y2, z))
for j in range(x):
	print(replace(m[j][0][0], m[j][0][1], m[j][1]))