Harsh, like usual, started studying 6 months before for his end semester examinations. He was going to complete his 8th revision of the whole syllabus, when suddenly Pranav showed up in his room with the last year's question paper for their algorithms course. This paper contains a problem which both of them couldn't solve. Frustrated he asked you for help. But you declined him and instead try to do this problem instead:
You are given an array $A_1,A_2,\dots,A_N$, a positive integer $K$, and a function $F(x)=\displaystyle\sum_{i=1}^{N}{\left|{\left({x-A_i}\right)^K}\right|}$. Find the smallest integer $x$ such that $F(x)$ is minimum.Input
- The first line contains two space-seperated integers , $N$ and $K$
- The second line contains $N$ space-seperated integers $A_1,A_2,\dots,A_N$. Output
In the first and only line print the smallest integer $x$ such that $F(x)$ is minimumConstraints
- $1 \leq N \leq {10}^{5}$
- $1 \leq K \leq {3}$
- $1 \leq A_i \leq {5}\times{10}^{4}$ for each valid $i$Sample Input 1
3 1
6 1 7
Sample Output 1
6
Explanation 1
$F(6) = \displaystyle\sum_{i=1}^{N}{\left|{\left({6-A_i}\right)^K}\right|} \\ F(6) = \left|{\left({6-6}\right)^1}\right| + \left|{\left({6-1}\right)^1}\right| + \left|{\left({6-7}\right)^1}\right| \\ F(6)  = 0 + 5+ 1 \\ F(6)  = 6 $
Here $6$ is the minumum value for $F(x)$ for any integer value of $x$.Sample Input 2
3 2
6 1 7
Sample Output 2
5
Explanation 2
$F(5) = \displaystyle\sum_{i=1}^{N}{\left|{\left({5-A_i}\right)^K}\right|} \\F(5) = \left|{\left({5-6}\right)^2}\right| + \left|{\left({5-1}\right)^2}\right| + \left|{\left({5-7}\right)^2}\right| \\F(5) = 1 + 16 + 4 \\F(5) = 21$ 
Here $21$ is the minumum value for $F(x)$ for any integer value of $x$.Sample Input 3
3 3
6 1 7
Sample Output 3
4
Explanation 3
$F(4) = \displaystyle\sum_{i=1}^{N}{\left|{\left({4-A_i}\right)^K}\right|} \\F(4) = \left|{\left({4-6}\right)^3}\right| + \left|{\left({4-1}\right)^3}\right| + \left|{\left({4-7}\right)^3}\right| \\F(4) = 8 + 27 + 27 \\F(4) = 62 $
Here $62$ is the minumum value for $F(x)$ for any integer value of $x$.

```python

USER_FILENAME = "<user_code>"
import sys, json, builtins
import math, heapq, bisect, itertools, functools, collections, statistics, fractions, decimal, operator, array, random, re, string, os, pathlib
try:
    import resource as _res
except Exception:
    _res = None
from collections import Counter, defaultdict, deque, OrderedDict
from functools import lru_cache, reduce
from itertools import accumulate, permutations, combinations, product
from math import gcd, ceil, floor, sqrt
from decimal import Decimal
try:
    from typing import *
except Exception:
    pass
try:
    sys.setrecursionlimit(1_000_000)
except Exception:
    pass
try:
    import site as _site
    try:
        _sys_sites = _site.getsitepackages() if hasattr(_site, "getsitepackages") else []
        for _p in _sys_sites:
            if _p and _p not in sys.path:
                sys.path.append(_p)
    except Exception:
        pass
    try:
        _usp = _site.getusersitepackages()
        if isinstance(_usp, str):
            _usp = [_usp]
        for _p in _usp:
            if _p and _p not in sys.path:
                sys.path.append(_p)
    except Exception:
        pass
except Exception:
    pass

ns = {"__name__": "__main__"}
for _k, _v in list(globals().items()):
    if not _k.startswith("_"):
        ns[_k] = _v
_CODE = '# cook your dish here\ndef func(n):\n\tsum = 0\n\tif k==1:\n\t\tfor i in l:\n\t\t\tsum+= abs(n-i)\n\t\treturn sum \n\tif k==2:\n\t\tfor i in l:\n\t\t\tsum+= (n-i)**2\n\t\treturn sum\n\tif k == 3:\n\t\tfor i in l:\n\t\t\tsum+= (abs(n-i))**3\n\t\treturn sum\ndef findPeakUtil(low,high,n):\n\tmid = low + (high-low)//2\n\tone = func(mid-1)\n\ttwo = func(mid)\n\tthree = func(mid+1)\n\t# print(one,two,three,mid)\n\tif (mid==0 or one >= two) and (mid==n-1 or three >= two):\n\t\treturn mid \n\telif (mid>0 and one < two):\n\t\treturn findPeakUtil(low,(mid-1),n)\n\telse:\n\t\treturn findPeakUtil(mid+1,high,n)\n\ndef findPeak(n): \n    return findPeakUtil(0, n - 1, n) \n\n(n,k) = map(int,input().split())\nl = list(map(int,input().split()))\nprint(findPeak(max(l)+2))'
_co = compile(_CODE, USER_FILENAME, "exec")
exec(_co, ns, ns)

```

Measured memory_bytes: 13445