Nam is playing with a string on his computer. The string consists of n lowercase English letters. It is meaningless, so Nam decided to make the string more beautiful, that is to make it be a palindrome by using 4 arrow keys: left, right, up, down.

There is a cursor pointing at some symbol of the string. Suppose that cursor is at position i (1 ≤ i ≤ n, the string uses 1-based indexing) now. Left and right arrow keys are used to move cursor around the string. The string is cyclic, that means that when Nam presses left arrow key, the cursor will move to position i - 1 if i > 1 or to the end of the string (i. e. position n) otherwise. The same holds when he presses the right arrow key (if i = n, the cursor appears at the beginning of the string).

When Nam presses up arrow key, the letter which the text cursor is pointing to will change to the next letter in English alphabet (assuming that alphabet is also cyclic, i. e. after 'z' follows 'a'). The same holds when he presses the down arrow key.

Initially, the text cursor is at position p. 

Because Nam has a lot homework to do, he wants to complete this as fast as possible. Can you help him by calculating the minimum number of arrow keys presses to make the string to be a palindrome?


-----Input-----

The first line contains two space-separated integers n (1 ≤ n ≤ 10^5) and p (1 ≤ p ≤ n), the length of Nam's string and the initial position of the text cursor.

The next line contains n lowercase characters of Nam's string.


-----Output-----

Print the minimum number of presses needed to change string into a palindrome.


-----Examples-----
Input
8 3
aeabcaez

Output
6



-----Note-----

A string is a palindrome if it reads the same forward or reversed.

In the sample test, initial Nam's string is: $\text{aeabcaez}$ (cursor position is shown bold).

In optimal solution, Nam may do 6 following steps:[Image]

The result, $\text{zeaccaez}$, is now a palindrome.

Difficulty: interview

Starter code:

Solutions:

n,pos= (int(x) for x in input('').split())
s = input('')

def dis(a, b):
    a=ord(a)
    b=ord(b)
    return min(abs(a - b), abs(a+26-b), abs(b+26-a))

d = [dis(s[i], s[len(s)-i-1]) for i in range((len(s) + 1)//2)]
pos -= 1
if pos >= (len(s) + 1) // 2:
    pos = len(s) - pos - 1
#print(pos)

#print(d)
for rightmost, v in enumerate(reversed(d)):
    if v!=0:
        rightmost = len(d) - rightmost - 1
        break
for leftmost, v in enumerate(d):
    if v!=0:
        break
#print(leftmost, rightmost)
ans = min(abs(rightmost - pos) + rightmost - leftmost, abs(pos - leftmost) + rightmost - leftmost) + sum(d)
if sum(d) == 0:
    print(0)
else:
    print(ans)



n,p = list(map(int,input().split()))
p -= 1
if p >= n//2: p = n-1-p
s = input()
d = [abs(ord(s[i])-ord(s[n-1-i])) for i in range(n//2)]
d = [min(x,26-x) for x in d]
first,last = -1,-1
for i in range(len(d)):
  if d[i] > 0:
    if first==-1: first = i
    last = i
a = 0 if first==-1 else min(abs(p-first), abs(p-last)) + (last-first) + sum(d)
print(a)


#fin = open("input.txt")
n, p = list(map(int, input().split()))
s = input().rstrip()
#n, p = map(int, fin.readline().split())
#s = fin.readline().rstrip()
p = min(p, n - p + 1)
Count = 0
M = l = r = X = p
for i in range(0, n // 2):
	#print(abs(ord(s[i]) - ord(s[-i - 1])), abs(ord('z') - max(ord(s[i]), ord(s[-i - 1])) + min(ord(s[i]), ord(s[-i - 1]) - ord('a') + 1) % 26), i)
	C = min(abs(ord(s[i]) - ord(s[-i - 1])), abs(ord('z') - max(ord(s[i]), ord(s[-i - 1])) + min(ord(s[i]), ord(s[-i - 1])) - ord('a') + 1) % 26)
	if C > 0:
		if (i + 1 < p):
			if (M == p):
				M = i + 1
			l = i + 1
		elif (i + 1 > p and r == p):
			r = i + 1
		X = i + 1
	Count += C
#print(Count)
#print(M, l, r, min(X * 2 - p - M, X + p - M * 2))
#print(X * 2 - p - M, X + p - M * 2)
print(Count + min(abs(X - p) + X - M, X + p - M * 2))


def distchar(a,b):
    a = ord(a)-ord('a')
    b = ord(b)-ord('a')
    if a>b: a,b = b,a
    return min(b-a,a+26-b)

def dist(i,p,n):
    if p>=i:
        sign = 1
    else:
        sign = -1
    return sign*min(abs(p-i),abs((n-1-i)-p))

        
[n,p] = [int(s) for s in input().split()]
s = input().strip()

p = p-1 # change to 0-based


##print(s)

count1 = 0
d = [0 for i in range(n)]
for i in range(n//2):    
    di = distchar(s[i],s[n-1-i])
    if di>0:
        d[i],d[n-1-i] = di,di
        count1 += di

if p>n//2: p = n-1-p

i1=0
while i1<p and d[i1]==0: i1+=1
i2=(n-1)//2
while i2>p and d[i2]==0: i2-=1
d1 = dist(i1,p,n)
d2 = dist(i2,p,n)
if d1*d2>0:
    count = count1 + max(abs(d1),abs(d2))
else:
    count = count1 + 2*min(abs(d1),abs(d2)) + max(abs(d1),abs(d2))
    
print(count)

    
##        print(' '.join(map(str,A[i])))
    



import math

(n, p) = map(int, input().split(' '))
S = input()
p = min(p-1,n-p)

s1 = S[0:int(n/2)]
s2 = S[-int(n/2):]
s2 = s2[::-1]
if s1==s2:
	print(0)
	return
l = int(n/2)
r = 0
ans = 0
for i in range(0, int(n/2)):
	if s1[i]!=s2[i]:
		if i<l:
			l = i
		if i>r:
			r = i
		ans += int( min(abs(ord(s1[i])-ord(s2[i])), abs(abs(ord(s1[i])-ord(s2[i]))-26) ))
ans += int( abs(r-l)+min(abs(r-p),abs(l-p)))
print(ans)

def dc(c, d):
    x, y = ord(c) - ord('a'), ord(d) - ord('a')
    return min(abs(x - y), 26 - max(x, y) + min(x, y))
def ds(s1, s2):
    r = 0
    a, b = 10 ** 5, -1
    for i in range(len(s1)):
        c, d = s1[i], s2[i]
        r += dc(c, d)
        if c != d:
            a = min(a, i)
            b = max(b, i)
    return a, b, r
n, p = list(map(int, input().split()))
s = input()
p -= 1
m = n // 2
y = m + (1 if n % 2 else 0)
s1, s2 = s[:m], s[y:][::-1]
a, b, r = ds(s1, s2)
#print(s1, s2, a, b, r)
d1 = min(abs(p - a), abs(p - b)) + abs(a - b)
d2 = min(abs(p - y - m + 1 + a), abs(p - y - m + 1 + b)) + abs(a - b)
#print(d1, d2)
if r == 0:
    print(0)
else:
    print(min(d1, d2) + r)


n,p=list(map(int,input().split()))
s=input()
ans=0
p-=1
if(n%2==1 and p==n//2 and n!=1):
    p-=1
    ans+=1
cnt=0
for i in range(n):
    if(n-1-i<=i):
        break
    if(s[i]!=s[n-1-i]):
        cnt+=1

if(p>=n//2 and n!=1):
    h=""
    for i in range(n-1,-1,-1):
        h+=s[i]
    s=h
    p=n-1-p
r=0
l=0
rr=0
ll=0
for i in range(p):
    if(s[i]!=s[n-1-i]):
        ans+=min(26-abs(ord(s[i])-ord(s[n-1-i])),abs(ord(s[i])-ord(s[n-1-i])))
        r+=1
        rr=max(rr,p-i)
for i in range(p+1,n//2):
    if(s[i]!=s[n-1-i]):
        ans+=min(26-abs(ord(s[i])-ord(s[n-1-i])),abs(ord(s[i])-ord(s[n-1-i])))
        l+=1
        ll=max(ll,i-p)
ans+=min(26-abs(ord(s[p])-ord(s[n-1-p])),abs(ord(s[p])-ord(s[n-1-p])))
ans+=ll+rr+min(ll,rr)
print(ans)


s = input()
p = int(s.split()[1])
s = input()
n = int(len(s))
a = []
if p > n//2:
    p = n - p + 1
sum = 0

if n == 1:
    print('0')
    quit()

for i in range(n//2):
    j = int(n-i-1)
    q = abs( ord(s[j]) - ord(s[i]) )
    #print(str(ord(s[i]))+' , '+str(ord(s[j])))
    #print(str(q)+' V '+str(26-q))
    a.append ( min(q,26-q))
    sum += a[i]
    
#print(sum)
i = 0
while (a[i] == 0) & (i<p-1) :
    i += 1
if i == p - 1:
    i = 0
else:
    i = p - i - 1
#print('i1 : '+str(i))
j = n//2 - 1
while (a[j] == 0) & (j>p-1):
    j -= 1
if j == p - 1:
    j = 0
else:
    j = j - p + 1
#print('i2 : '+str(j))
sum += min(i,j)*2 + max(i,j)
print(str(sum))

def calc(c1, c2):
    x = abs(ord(c1)-ord(c2))
    return min(x, 26-x)

a, b = list(map(int, input().split(' ')))
strx = input()

if a % 2 == 0:
    if b > a // 2:
        b = a + 1 - b
    left = strx[:a // 2]
    right = strx[a // 2:]
    right = right[::-1]
    dist = [calc(left[i], right[i]) for i in range(a // 2)]
    indx = b - 1
    rightpt = b - 1
    leftpt = b - 1
    for i in range(a // 2):
        if dist[i] != 0:
            leftpt = i
            break
    dist.reverse()
    for i in range(a // 2):
        if dist[i] != 0:
            rightpt = (a // 2 - 1) - i
            break
        
    sumlr = rightpt - leftpt + min(abs(leftpt - indx), abs(rightpt - indx))
    print(sum(dist) + sumlr)

else:
    if b > a // 2 + 1:
        b = a + 1 - b
    left = strx[:a // 2]
    right = strx[a // 2:][1:]
    right = right[::-1]
    dist = [calc(left[i], right[i]) for i in range(a // 2)]
    indx = b - 1
    rightpt = b - 1
    leftpt = b - 1
    for i in range(a // 2):
        if dist[i] != 0:
            leftpt = i
            break
    dist.reverse()
    for i in range(a // 2):
        if dist[i] != 0:
            rightpt = (a // 2 - 1) - i
            break
    sumlr = rightpt - leftpt + min(abs(leftpt - indx), abs(rightpt - indx))
    print(sum(dist) + sumlr)


n, p = map(int, input().split())
t = input()
k = n // 2
d = [0] * (k + 1)
for i in range(k):
    d[i] = abs(ord(t[i]) - ord(t[n - i - 1]))
    if 2 * d[i] > 26: d[i] = 26 - d[i]
p = n - p if p > k else p - 1
if d.count(0) == k + 1: print(0)
else:
    i, j = 0, k
    while d[i] == 0: i += 1
    while d[j] == 0: j -= 1
    if i > p: i = p
    if j < p: j = p
    print(sum(d) + min(p - 2 * i + j, 2 * j - i - p))

n, p = [int(i) for i in input().split()]
p -= 1
p = min(p, n - p - 1)
s = input()
ans = 0
m1 = None
m2 = 0
for i in range(n):
    if n - i - 1 < i:
        break
    if s[i] != s[-i - 1]:
        if m1 is None:
            m1 = i
        m2 = max(m2, i)
    ans += min(abs(ord(s[i]) - ord(s[-i - 1])), 26 - abs(ord(s[i]) - ord(s[-i - 1])))
if m1 is None:
    print(0)
    return
if m2 <= p:
    x = p - m1
elif m1 >= p:
    x = m2 - p
else:
    x = min(2 * (m2 - p) + p - m1, 2 * (p - m1) + m2 - p)
print(ans + x)

import math
def min_dist(c1,c2):
    g = abs(ord(c1)-ord(c2))
    return(min(g,26-g))
        
length, p = [int(k) for k in input().split()]
s = str(input())
s = " " + s
mid = int(len(s)/2)
#print(mid)
if p > mid:
    p = len(s)  - p
#print(p)
diff = [0] *(length+1) #if position i different from length - i, then diff[i] = 1
for i in range(1,mid+1):
    #print(s[i], s[length-i +1])
    if s[i] != s[length - i +1]:
        diff[i] = 1
        diff[length-i+1] = 1
#print(diff)
left = 0
right = 0
for i in range(1,p):
    if diff[i]==1:
        left = p-i
        break
g = mid
if length % 2 ==1:
    g = g - 1
for i in range(g,p,-1):
    if diff[i] ==1:
        right = i-p
        break

#print(left,right)

if left >= right: #go right first
    horizontal = 2*right + left
else:
    horizontal = 2*left + right
    
vertical = 0
for i in range(1,mid+1):
    if diff[i] == 1:
        vertical += min_dist(s[i], s[length-i +1])
        #print(min_dist(s[i], s[length-i +1]))
print(horizontal + vertical)

n,p=[int(x) for x in input().split()]
p-=1
atz='qwertyuiopasdfghjklzxcvbnm'
if len(atz)!=26:
    print('gone wrong')
d={}
for i in atz:
    for j in atz:
        x=abs(ord(i)-ord(j))
        x=min(x,26-x)
        d[(i,j)]=x
s=input()
i=0
j=len(s)-1
m=(n+1)//2
if p>=m:
    p=n-1-p
    s=s[::-1]
revs=s[::-1]
cost=0
while i<j:
#    print(s,i,j)
    cost+=d[(s[i],s[j])]
    i+=1
    j-=1
if cost==0:
    print(cost)
    return
l=0
#print('mid cost',cost)
while d[(s[l],revs[l])]==0:
    l+=1
r=(n//2)-1
while d[(s[r],revs[r])]==0:
    r-=1
#print(l,r,p)
cost+=r-l+min(abs(l-p),abs(r-p))
print(cost)


n,p=[int(x) for x in input().split()]
p-=1
atz='qwertyuiopasdfghjklzxcvbnm'
if len(atz)!=26:
    print('gone wrong')
d={}
for i in atz:
    for j in atz:
        x=abs(ord(i)-ord(j))
        x=min(x,26-x)
        d[(i,j)]=x
s=input()
i=0
j=len(s)-1
m=(n+1)//2
if p>=m:
    p=n-1-p
    s=s[::-1]
revs=s[::-1]
cost=0
while i<j:
#    print(s,i,j)
    cost+=d[(s[i],s[j])]
    i+=1
    j-=1
if cost==0:
    print(cost)
    return
l=0
#print('mid cost',cost)
while d[(s[l],revs[l])]==0:
    l+=1
r=(n//2)-1
while d[(s[r],revs[r])]==0:
    r-=1
#print(l,r,p)
cost+=r-l+min(abs(l-p),abs(r-p))
print(cost)


def change(a,b):
    a,b=ord(a)-96,ord(b)-96
    a,b=max(a,b),min(a,b)
    return min(a-b,26+b-a)

def mini(arr,p):
    if len(arr)==0:
        return 0
    if arr[-1]<=p:
        #print(arr[-1],p)
        return p-arr[0]
    if arr[0]>=p:
        return arr[-1]-p
    return min((arr[-1]-p),(p-arr[0]))+(arr[-1]-arr[0])

def func(s,p):
    mid=(len(s)+1)/2
    if p>mid:
        p=mid-(p-mid)
    mid=int(len(s)/2)
    steps=0
    mis=[]
    for i in range(mid):
        if s[i]!=s[len(s)-1-i]:
            steps+=change(s[i],s[len(s)-1-i])
            mis.append(i+1)
    #print(steps)
    steps=steps+mini(mis,p)
    return steps

            
l=list(map(int,input().split()))
pos=l[1]
s=input()
ans=func(s,pos)
print(int(ans))

def change(a,b):
    a,b=ord(a)-96,ord(b)-96
    a,b=max(a,b),min(a,b)
    return min(a-b,26+b-a)

def mini(arr,p):
    if len(arr)==0:
        return 0
    if arr[-1]<=p:
        #print(arr[-1],p)
        return p-arr[0]
    if arr[0]>=p:
        return arr[-1]-p
    return min((arr[-1]-p),(p-arr[0]))+(arr[-1]-arr[0])

def func(s,p):
    mid=(len(s)+1)/2
    if p>mid:
        p=mid-(p-mid)
    mid=int(len(s)/2)
    steps=0
    mis=[]
    for i in range(mid):
        if s[i]!=s[len(s)-1-i]:
            steps+=change(s[i],s[len(s)-1-i])
            mis.append(i+1)
    #print(steps)
    steps=steps+mini(mis,p)
    return steps

            
l=list(map(int,input().split()))
pos=l[1]
s=input()
ans=func(s,pos)
print(int(ans))


f = lambda c: ord(c) - ord('a')
dalp = lambda x, y: min(abs(x - y), abs(x + 26 - y), abs(y + 26 - x))
dist = lambda i, j: min(abs(i - j), abs(i + n - j), abs(j + n - i))
read = lambda: list(map(int, input().split()))
n, p = read()
a = [f(i) for i in input()]
pr, sf = [], []
cnt = 0
for i in range(n // 2):
    if a[i] != a[n - i - 1]:
        cnt += dalp(a[i], a[n - i - 1])
        pr.append(i)
        sf.append(n - i - 1)
if pr:
    p -= 1
    d1 = dist(pr[0], pr[-1])
    d2 = min(dist(p, pr[0]), dist(p, pr[-1]), dist(p, sf[0]), dist(p, sf[-1]))   
    cnt += d1 + d2
print(cnt)



def main():
    s = "abcdefghijklmnopqrstuvwxyz"
    d = {(a, b): min((ord(a) - ord(b)) % 26, (ord(b) - ord(a)) % 26) for a in s for b in s}
    n, m = list(map(int, input().split()))
    s, res, n, m = input(), 0, n - 1, min(m - 1, n - m)
    idx = [i for i, a in zip(list(range((n + 1) // 2)), s) if a != s[n - i]]
    print((sum(d[s[i], s[n - i]] for i in idx) + min(abs(m - idx[0]), abs(m - idx[-1])) + idx[-1] - idx[0]) if idx else 0)


def __starting_point():
    main()

__starting_point()

n, p = map(int, input().split())
p -= 1
s = input()
arr = [(lambda x, y: min(abs(x - y), 26 - abs(y - x)))(ord(s[i]), ord(s[n - i - 1])) for i in range(n // 2)]
p = min(p, n - p - 1)
f, l = 0, len(arr) - 1
for a in arr:
	if a != 0:
		break
	else:
		f += 1
for a in reversed(arr):
	if a != 0:
		break
	else:
		l -= 1
print(sum(arr) + l - f + min(abs(p - l), abs(p - f)) if sum(arr) > 0 else 0)

'''
def main():
	from sys import stdin,stdout
def __starting_point():
	main()
'''
#Journey to moon
'''
def main():
	from sys import stdin,stdout
	import collections
	N,I =map(int,stdin.readline().split())
	visited=list(0 for x in range(N))
	G=collections.defaultdict(list)
	groups=[0]
	for _ in range(I):
		a,b=map(int,stdin.readline().split())
		G[a].append(b)
		G[b].append(a)
	q=collections.deque()
	flag=0
	for i in range(N):
		if not visited[i]:
			q.append(i)
			visited[i]=flag+1
			groups[flag]+=1
			while len(q):
				top=q.popleft()
				for j in G[top]:
					if visited[j]!=visited[top]:
						visited[j]=flag+1
						groups[flag]+=1
						q.append(j)
			flag+=1
			groups.append(0)
	counter=0
	for i in range(len(groups)-1):
		for j in range(i+1,len(groups)):
			counter+=groups[i]*groups[j]
	stdout.write(str(counter))
def __starting_point():
	main()
'''
#Djikstra's
'''
import collections
class Graph:
	def __init__(self):
		self.nodes=set()
		self.edges=collections.defaultdict(list)
		self.distances = {}

	def add_node(self, value):
		self.nodes.add(value)

	def add_edge(self, from_node, to_node, distance):
		self.edges[from_node].append(to_node)
		self.edges[to_node].append(from_node)
		self.distances[(from_node, to_node)] = distance
		self.distances[(to_node, from_node)] = distance


def dijsktra(graph, initial):
	visited = {initial: 0}
	path = {}

	nodes = set(graph.nodes)

	while nodes:
		min_node = None
		for node in nodes:
			if node in visited:
				if min_node is None:
					min_node = node
				elif visited[node] < visited[min_node]:
					min_node = node

		if min_node is None:
			break

		nodes.remove(min_node)
		current_weight = visited[min_node]

		for edge in graph.edges[min_node]:
			weight = current_weight + graph.distances[(min_node, edge)]
			if edge not in visited or weight < visited[edge]:
				visited[edge] = weight
				path[edge] = min_node

	return visited, path

def main():
	from sys import stdin,stdout
	for _ in range(int(stdin.readline())):
		n,m=map(int,stdin.readline().split())
		G=Graph()
		for i in range(n):
			G.add_node(i+1)
		for i in range(m):
			a,b,c=map(int,stdin.readline().split())
			G.add_edge(a,b,c)
		initial=int(stdin.readline())
		v,p=dijsktra(G, initial)
		#print(v)
		#print(p)
		for i in range(1,n+1):
			if i!=initial:
				k=v.get(i,-1)
				stdout.write(str(k)+' ')
		stdout.write('\n')
def __starting_point():
	main()
'''
#Larget pallindrome in String
'''
def main():
	from sys import stdin,stdout
	string=stdin.readline().strip()
	l=len(string)
	#Triangle logic	
	
	arrlen=(l*(l-1))//2
	arr=list(0 for x in range(arrlen))
	f=0
	c=l-1
	for i in range(l-1):
		for j in range(i+1,l):
			if string[i]==string[j]:
				arr[f+j-i-1]=1
		f+=c
		c-=1
	#print(arr)
	if any(arr):
		
	else:
		if l & 1:
			stdout.write('First')
		else:
			stdout.write('Second')
	#2-d Array Logic
	arr=list(list(0 for i in range(l)) for j in range(l))
	for i in range(l):
		for j in range(l):
			if string[i]==string[j]:
				arr[i][j]=1
	maxim=0
	for i in range(0,l*(l-1)-2,l+1):
		a,b=i+1,i+2
		#print(a,b)
		acount=0
		x=a//5
		y=a%5
		acount=arr[x][y]		
		x-=1
		y-=1
		while x>=0 and y>=0:
			acount+=arr[x][y]
			x-=1
			y-=1
		x=b//5
		y=b%5
		bcount=arr[x][y]		
		x-=1
		y-=1
		while x>=0 and y>=0:
			bcount+=arr[x][y]
			x-=1
			y-=1
		maxim=max((acount,bcount,maxim))
	maxim=max(maxim,arr[l-2][l-1])
	maxim=(maxim<<1)^1
	delta=l-maxim
	if delta & 1:
		stdout.write('Second')
	else:
		stdout.write('First')
def __starting_point():
	main()
'''
#276B
'''
def main():
	from sys import stdin,stdout
	import collections
	s=stdin.readline().strip()
	count=collections.Counter(s)
	l=list(filter(lambda x: count[x] & 1,list(x for x in count)))
	removed=sum(list(count[x] for x in l))-max(list(count[x] for x in l)+[0])
	if removed & 1:
		stdout.write('Second')
	else:
		stdout.write('First')
def __starting_point():
	main()
'''
#362B
'''
def main():
	from sys import stdin,stdout
	n,m=map(int,stdin.readline().split())
	if m:
		dirty=sorted(map(int,stdin.readline().split()))
		if dirty[0]==1 or dirty[-1]==n:
			stdout.write('NO')
		else:
			flag=True
			for i in range(m-2):
				if dirty[i+1]==dirty[i]+1 and dirty[i+2]==dirty[i]+2:
					flag=False
					break
			if flag:
				stdout.write('YES')
			else:
				stdout.write('NO')
	else:
		stdout.write('YES')
def __starting_point():
	main()
'''
#279B SUM OF SUB-ARRAY
'''
def main():
	from sys import stdin,stdout
	n,t=map(int,stdin.readline().split())
	arr=list(map(int,stdin.readline().split()))
	maxim=0
	curr_sum=arr[0]
	i=0
	j=1
	if curr_sum <=t:
		count=1
	else:
		curr_sum=0
		count=0
		i=1
		j=2
	while j<n:
		if curr_sum+arr[j]<=t:
			count+=1
			curr_sum+=arr[j]
			j+=1
		else:
			maxim=max(count,maxim)
			if curr_sum:
				curr_sum-=arr[i]
				count-=1
			else:
				j+=1
			i+=1
	maxim=max(count,maxim)
	stdout.write(str(maxim))
def __starting_point():
	main()
'''
#469B
'''
def main():
	from sys import stdin,stdout
	p,q,l,r=map(int,stdin.readline().split())
	a=[]
	b=[]
	visited=list(0 for x in range(r-l+1))
	#print(visited)	
	for i in range(p):
		x,y=map(int,stdin.readline().split())
		a.append(x)
		b.append(y)
	for i in range(q):
		x,y=map(int,stdin.readline().split())
		x+=l
		y+=l
		for j in range(p):
			#print('x=',x,'y=',y)
			lower=max(0,a[j]-y)
			upper=min(b[j]-x,r)+1
			if upper > lower:
				delta=upper-lower
				#print('upper=',upper,'lower=',lower)
				visited[lower:upper]=list(1 for x in range(delta))
				#print('visited:\n',visited)
	#	print(visited)
	stdout.write(str(visited[:r-l+1].count(1)))
def __starting_point():
	main()
'''
'''
def main():
	from sys import stdin,stdout
	#import numpy as np
	n,k=map(int,stdin.readline().split())
	a=tuple(map(int,stdin.readline().split()))
	minim=min(a)
	maxim=max(a)
	arr=list(a)	
	for i in range(n):
		arr[i]-=minim
	if max(arr) > k:
		stdout.write('NO')
	else:
		stdout.write('YES\n')
		for i in a:
			stdout.write('1 '*minim)
			for j in range(i-minim):
				stdout.write(str(j%k+1)+' ')
			stdout.write('\n')
def __starting_point():
	main()
'''
'''
def main():
	from sys import stdin,stdout
	n,p=[],[]
	for _ in range(int(stdin.readline())):
		last=int(stdin.readline())
		if last<0:
			n.append(-1*last)
		else:
			p.append(last)
	if sum(p)>sum(n):
		stdout.write('first')
	elif sum(n)>sum(p):
		stdout.write('second')
	else:
		maxim=max(n,p)
		#print(maxim)
		if maxim==p:
			if maxim==n:
				if last<0:
					stdout.write('second')
				else:
					stdout.write('first')
			else:
				stdout.write('first')
		else:
			stdout.write('second')
		
def __starting_point():
	main()
'''
#286C
'''
def main():
	from sys import stdin,stdout
	m,n=map(int,stdin.readline().split())
	minim=min(m,n)
	stdout.write(str(minim+1)+'\n')
	if n==minim:
		for i in range(minim+1):
			stdout.write(str(m)+' '+str(i)+'\n')
			m-=1
	else:
		for i in range(minim+1):
			stdout.write(str(i)+' '+str(n)+'\n')
			n-=1
def __starting_point():
	main()
'''
#387B
'''
def main():
	from sys import stdin,stdout
	n,m=map(int,stdin.readline().split())
	a=tuple(map(int,stdin.readline().split()))
	b=tuple(map(int,stdin.readline().split()))
	i=0
	j=0
	while True:
		#print(i,j)
		if i>=n or j>=m:
			break
		if b[j]>=a[i]:
			i+=1
			j+=1
		else:
			j+=1
	stdout.write(str(n-i))
def __starting_point():
	main()
'''
#365B
'''
def main():
	from sys import stdin,stdout
	n=int(stdin.readline())
	a=tuple(map(int,stdin.readline().split()))
	maxim=2
	count=2
	i=2
	while True:
		if i>=n:
			break
		if a[i]==a[i-1]+a[i-2]:
			count+=1
			maxim=max(count,maxim)
		else:
			count=2
		i+=1
	stdout.write(str(min(maxim,n)))
def __starting_point():
	main()
'''	#474D
'''
def main():
	from sys import stdin,stdout
	MOD=int(1e9)+7
	T,k=map(int,stdin.readline().split())
	fib=[x for x in range(1,k+1)]
	for i in range(k,100001):
		fib.append((fib[i-1]+fib[i-k]+1)%MOD)
	for _ in range(T):
		a,b=map(int,stdin.readline().split())
		stdout.write(str((fib[b]-fib[a-1])%MOD)+'\n')
def __starting_point():
	main()
'''
#330B
#not working
'''
def main():
	from sys import stdin,stdout
	import collections
	road_not=collections.defaultdict(set)
	n,m=map(int,stdin.readline().split())
	for _ in range(m):
		a,b=map(int,stdin.readline().split())
		road_not[a].add(b)
		road_not[b].add(a)
	counter=0
	road=collections.defaultdict(set)
	visited=[0 for x in range(n)]
	visited[0]=True
	for index in range(1,n+1):
		for i in range(1,n+1):
			if not visited[i-1]:
				if i not in road_not[index] and i!=index:
					counter+=1
					road[index].add(i)
					visited[i-1]=True
	stdout.write(str(counter)+'\n')
	for i in road:
		for j in road[i]:
			stdout.write(str(i)+' '+str(j)+'\n')
def __starting_point():
	main()
'''
#208D
'''
def main():
	from sys import stdin,stdout
	import bisect
	n=int(stdin.readline())
	p=tuple(map(int,stdin.readline().split()))
	P=tuple(map(int,stdin.readline().split()))
	record=[0 for x in range(5)]
	points=0
	for i in p:
		points+=i
		while points>=P[0]:
			index=bisect.bisect_right(P,points)
			if index:
				index-=1
				number=points//P[index]
				record[index]+=number
				points-=P[index]*number
	for i in record:
		stdout.write(str(i)+' ')
	stdout.write('\n'+str(points))
def __starting_point():
	main()
'''
#339D Using Al.Cash's Segment Trees
#Segment Tree
#not-working
'''
powers=1
t=[0 for x in range(3*int(1e5))]
def build(n):
	nonlocal t,powers
	flag=False
	for i in range(n-1,0,-1):
		if i==powers-1:
			flag=not flag
			powers>>=1
		if flag:
			t[i]=t[i<<1]^t[i<<1|1]
		else:
			t[i]=t[i<<1]|t[i<<1|1]

def modify(i,v,n):
	nonlocal t
	flag=False
	if t[i+n-1]==v or v|t[(i+n-1)^1]==t[(i+n-1)>>1]:
		#print('skipped')
		#print('t[i+n-1]=',t[i+n-1],'v=',v)
		#print('v|t[(i+n-1)^1]=',v|t[(i+n-1)^1],'t[(i+n-1)>>1]',t[(i+n-1)>>1])		
		t[i+n-1]=v		
		return
	t[i+n-1]=v
	p=i+n-1
	while p>1:
		if flag:
			if t[p>>1]==t[p]^t[p^1]:
				break
			t[p>>1]=t[p]^t[p^1]
			flag=not flag
		else:
			if t[p>>1]==t[p]|t[p^1]:
				break
			t[p>>1]=t[p]|t[p^1]
			flag=not flag
		p>>=1

def main():
	from sys import stdin,stdout
	nonlocal t,powers
	n,m=map(int,stdin.readline().split())
	p=tuple(map(int,stdin.readline().split()))
	powers=1<<(n-1)	
	n=1<<(n)	
	for i in range(n):
		t[i+n]=p[i]
	build(n)
	#print(t[:2*n])
	for _ in range(m):
		a,b=map(int,stdin.readline().split())
		modify(a,b,n)
		#print(t[:2*n])
		stdout.write(str(t[1])+'\n')
def __starting_point():
	main()
'''
#330B
'''
def main():
	from sys import stdin,stdout
	n,m=map(int,stdin.readline().split())
	start_not=set()
	for _ in range(m):
		a,b=map(int,stdin.readline().split())
		start_not.add(a-1)
		start_not.add(b-1)
	visited=[False for _ in  range(n)]
	for i in range(n):
		if i not in start_not:
			center=i
			break
	stdout.write(str(n-1)+'\n')
	for i in range(n):
		if i != center:
			stdout.write(str(center+1)+' '+str(i+1)+'\n')
def __starting_point():
	main()
'''
#116B
'''
def main():
	from sys import stdin,stdout
	n,m=map(int,stdin.readline().split())
	arr=[]
	for _ in range(n):
		arr.append(stdin.readline().strip())
	pigs=set()
	count=0
	for i in range(n):
		for j in range(m):
			if arr[i][j]=='W':
				flag=0
				if i>0:
					if arr[i-1][j]=='P':
						pigs.add((i-1,j))
						flag=1
				if i<n-1:
					if arr[i+1][j]=='P':
						pigs.add((i+1,j))
						flag=1
				if 	j>0:
					if arr[i][j-1]=='P':
						pigs.add((i,j-1))
						flag=1
				if j<m-1:
					if arr[i][j+1]=='P':
						pigs.add((i,j+1))
						flag=1
				if flag:
					count+=1
	stdout.write(str(min(len(pigs),count)))
def __starting_point():
	main()
'''
#339D using Al.Cash's Segment Tree Implementation
'''
def main():
	from sys import stdin,stdout
	answers=()
	n,m=map(int,stdin.readline().split())
	p=tuple(map(int,stdin.readline().split()))
	powers=1<<(n-1)
	n=powers<<1
	t=[0 for _ in range(n<<1)]
	for i in range(n):
		t[n+i]=p[i]
	flag=False
	for i in range(n-1,0,-1):
		if i==powers-1:
			flag=not flag
			powers>>=1
		if flag:
			t[i]=t[i<<1]^t[i<<1|1]
		else:
			t[i]=t[i<<1]|t[i<<1|1]
	for _ in range(m):
		a,b=map(int,stdin.readline().split())
		flag=False
		if t[a+n-1]==b or b|t[(a+n-1)^1]==t[(a+n-1)>>1]:
			t[a+n-1]=b
		else:
			t[a+n-1]=b
			p=a+n-1
			while p > 1:
				if flag:
					if t[p>>1]==t[p]^t[p^1]:
						break
					t[p>>1]=t[p]^t[p^1]
					flag=not flag
				else:
					if t[p>>1]==t[p]|t[p^1]:
						break
					t[p>>1]=t[p]|t[p^1]
					flag= not flag
				p>>=1
		stdout.write(str(t[1])+'\n')
def __starting_point():
	main()
'''
#515C
'''
def main():
	from sys import stdin,stdout
	import collections
	nc=[0 for x in range(10)]
	n=int(stdin.readline())
	num=stdin.readline().strip()
	for i in num:
		k=int(i)
		if k==9:
			nc[7]+=1
			nc[3]+=2
			nc[2]+=1
		elif k==8:
			nc[7]+=1
			nc[2]+=3
		elif k==7:
			nc[7]+=1
		elif k==6:
			nc[5]+=1
			nc[3]+=1
		elif k==5:
			nc[5]+=1
		elif k==4:
			nc[3]+=1
			nc[2]+=2
		elif k==3:
			nc[3]+=1
		elif k==2:
			nc[2]+=1
	ans=''
	for i in range(10):
		ans+=str(9-i)*nc[9-i]
	stdout.write(ans)		
def __starting_point():
	main()
'''
#313B
'''
def main():
	from sys import stdin,stdout
	s=stdin.readline().strip()
	flag=s[0]
	if flag=='.':
		anti='#'
	else:
		anti='.'
	n=len(s)
	l=[0 for x in range(n)]
	for i in range(1,n):
		if s[i]==flag:
			l[i]=l[i-1]+1
		else:
			flag,anti=anti,flag
			l[i]=l[i-1]
	#print(l)
	for _ in range(int(stdin.readline())):
		a,b=map(int,stdin.readline().split())
		stdout.write(str(l[b-1]-l[a-1])+'\n')
def __starting_point():
	main()
'''
#431C
'''
def main():
	from sys import stdin,stdout
	MOD=int(1e9)+7
	n,k,d=map(int,stdin.readline().split())
	d-=1
	klist=[(1<<i)%MOD for i in range(k)]
	klist=[1]+klist
	for i in range(k+1,n+1):
		klist.append((klist[i-1]*2-klist[i-1-k])%MOD)
	if d:	
		dlist=[(1<<i)%MOD for i in range(d)]
		dlist=[1]+dlist
		for i in range(d+1,n+1):
			dlist.append((dlist[i-1]*2-dlist[i-1-d])%MOD)
	#print(klist)
	#print(dlist)
		ans=klist[n]-dlist[n]
	else:
		ans=klist[n]
	stdout.write(str(ans%MOD))
def __starting_point():
	main()
'''
#441C
'''
def main():
	from sys import stdin,stdout
	n,m,k=map(int,stdin.readline().split())
	if n>=m:
		i=-1
		j=-1
		num=n*m
		while k:
			ans=num//k
			stdout.write(str(ans)+' ')
			counter=0
			while counter<ans:
				if j==-1:
					flag=True
					i+=1
					j+=1
				if j==m:
					flag=False
					i+=1
					j-=1
				stdout.write(str(i+1)+' '+str(j+1)+' ')
				if flag:
					j+=1
				else:
					j-=1
				counter+=1
			num-=ans
			k-=1
			stdout.write('\n')
	else:
		i=-1
		j=-1
		num=n*m
		while k:
			ans=num//k
			stdout.write(str(ans)+' ')
			counter=0
			while counter<ans:
				if i==-1:
					flag=True
					j+=1
					i+=1
				if i==n:
					flag=False
					j+=1
					i-=1
				stdout.write(str(i+1)+' '+str(j+1)+' ')
				if flag:
					i+=1
				else:
					i-=1
				counter+=1
			num-=ans
			k-=1
			stdout.write('\n')
def __starting_point():
	main()
'''
#538B
'''
def main():
	from sys import stdin,stdout
	n=int(stdin.readline())
	ans=[]
	while n:
		t=''
		num=str(n)
		for i in num:
			if int(i):
				t+='1'
			else:
				t+='0'
		ans.append(t)
		n-=int(t)
	stdout.write(str(len(ans))+'\n')
	for i in ans:
		stdout.write(i+' ')
def __starting_point():
	main()
'''
#486C
def main():
	from sys import stdin,stdout
	n,o=list(map(int,stdin.readline().split()))
	string=stdin.readline().strip()
	if n & 1:
		s1=string[:n//2]
		s2=string[n//2+1:]
		rev=s2[::-1]
		minim=0
		indexlist=[]
		for i in range(n//2):
			k=abs(ord(s1[i])-ord(rev[i]))
			minim+=min(k,26-k)
			if k:
				indexlist.append(i)
		if o>n//2:
			o=(n-o)
		else:
			o-=1
		if len(indexlist):
			indexlist+=[o]
			for i in range(len(indexlist)):
				indexlist[i]=indexlist[i]-o
			minia=min(indexlist)
			maxia=max(indexlist)
			minim+=min(abs(minia),abs(maxia))*2+max(abs(minia),abs(maxia))
		stdout.write(str(minim))
	else:
		s1=string[:n//2]
		s2=string[n//2:]
		rev=s2[::-1]
		#print(s1,rev)
		minim=0
		indexlist=[]
		for i in range(n//2):
			k=abs(ord(s1[i])-ord(rev[i]))
			minim+=min(k,26-k)
			if k:
				indexlist.append(i)
		if o > n//2:
			o=(n-o)
		else:
			o-=1
		#print(minim)
		#print(indexlist)
		if len(indexlist):
			indexlist+=[o]
			for i in range(len(indexlist)):
				indexlist[i]=indexlist[i]-o
			#print(indexlist)
			minia=min(indexlist)
			maxia=max(indexlist)
			minim+=min(abs(minia),abs(maxia))*2+max(abs(minia),abs(maxia))
		stdout.write(str(minim))
def __starting_point():
	main()
#4B
'''
def main():	
	from sys import stdin,stdout
	n,sumtime=map(int,stdin.readline().split())
	a,b=[],[]
	for i in range(n):
		x,y=map(int,stdin.readline().split())
		a.append(x)
		b.append(y)
	if sum(b)<sumtime or sum(a)>sumtime:
		stdout.write('NO')
	else:
		stdout.write('YES\n')
		diff=sumtime-sum(a)
		for i in range(n):
			if diff:
				k=b[i]-a[i]
				minim=min(k,diff)
				a[i]+=minim
				diff-=minim
		for i in a:
			stdout.write(str(i)+' ')
def __starting_point():
	main()
'''
#282B
'''
def main():
	from sys import stdin,stdout
	n=int(stdin.readline())
	a,b=[],[]
	for i in range(n):
		x,y=map(int,stdin.readline().split())
		a.append(x)
		b.append(y)
	if a[0]>b[0]:
		total=-1*b[0]
		t='G'
	else:
		total=a[0]
		t='A'
	for i in range(1,n):
		if total+a[i]>=500:
			total-=b[i]
			t+='G'
		else:
			total+=a[i]
			t+='A'
	if total<-500 or total >500:
		stdout.write('-1')
	else:
		stdout.write(t)
def __starting_point():
	main()
'''

__starting_point()

import sys

def dbg(*args):
    print('D:', *args, file=sys.stderr)

n, p = map(int, input().split())
s = input()

if s == s[::-1]:
    print('0')
else:
    sz = len(s)
    if p > sz//2:
        p = sz - p
    else:
        p -= 1

    l, r = 0, sz//2 - 1
    while s[l] == s[-l - 1]: l += 1
    while s[r] == s[-r - 1]: r -= 1
    dbg(l, r, p)
    sum = r - l
    sum += min(abs(p - l), abs(r - p))
    for i in range(l, r + 1):
        a1 = ord(s[i])
        a2 = ord(s[-i - 1])
        if (a1 > a2):
            a1, a2 = a2, a1
        sum += min(a2 - a1, a1 + 26 - a2)
    print(sum)

n, p = list(map(int, input().split()))
string = input()

def calc_delta(s):
    """Calculates and returns the alphabetical differences between every pair
    of indices (i, n-i-1) in the string s. Returns a map between an index and
    the delta value to correct to a palindrome.
    """
    def get_min_shift(i):
        ord_diff = abs(ord(s[i]) - ord(s[n-i-1]))
        return min(ord_diff, 26 - ord_diff)

    return {i : get_min_shift(i) for i in range((n + 1) // 2)}

def palindrome(s):
    deltas = calc_delta(s)
    offset_indices = list([i for i in list(deltas.keys()) if deltas[i] > 0])
    if not offset_indices:
        return 0
    alpha_delta = sum(deltas.values())
    mindex = min(offset_indices) # Smallest index with a mismatch
    maxdex = max(offset_indices) # Largest index in the smaller half with a mismatch
    sindex = min(p - 1, n - p) # Starting pointer index
    if mindex == maxdex or maxdex <= sindex:
        travel_delta = abs(sindex - mindex)
        return travel_delta + alpha_delta
    if mindex >= sindex:
        return maxdex - sindex + alpha_delta
    min_delta = min(maxdex - sindex, sindex - mindex)
    max_delta = max(maxdex - sindex, sindex - mindex)
    travel_delta = 2 * min_delta + max_delta
    return travel_delta + alpha_delta

print(palindrome(string))


n, p = map(int, input().split())
p -= 1
s = input()
if p>=n//2:
	p = n-1-p
l = 0
r = n//2-1

while l<n//2 and (s[l]==s[n-1-l]):
	l += 1
while r>=0 and (s[r] == s[n-1-r]):
	r -= 1
ans, ch = 0, 0
for i in range(l, r+1):
	temp = abs(ord(s[i])-ord(s[n-1-i]))
	ch += min(temp, 26-temp)
	#print (min(temp, 26-temp),s[i], s[n-1-i])
if l < r:
	#print (min(abs(p-r), abs(p-l))+ abs(r-l) + ch)
	ans += min(abs(p-r), abs(p-l)) + abs(r-l) + ch
elif l==r:
	if ch:
		ans += abs(p-l)+ch
print(ans)

n, p = list(map(int, input().split()))
p -= 1
st = input().strip()
l = 0
h = n // 2 - 1
if p > h:
    p = n - 1 - p
inside = False
ans = 0
i = 0
H = -1 
while i <= h:
    if st[i] != st[n - 1 - i]:
        if not inside:
            l = i
            inside = True
        H = i
    ans += min(abs(ord(st[i]) - ord(st[n - 1 - i])), abs(ord('z') - ord('a') + 1 - abs(ord(st[i]) - ord(st[n - 1 - i]))))
    i += 1
h = H
if h == -1:
    print("0")
    return
ans += h - l
ans += min(abs(l - p), abs(p - h))
print(ans)