#include<bits/stdc++.h>
using namespace std;
#define int long long
inline int read()
{
	int sum = 0, nega = 1; char ch = getchar();
	while(ch > '9' || ch < '0') {if(ch == '-') nega = -1; ch = getchar();}
	while(ch <= '9' && ch >= '0') sum = sum * 10 + ch - '0', ch = getchar();
	return sum * nega;
}
const int N = 2e6 + 9, mod = 998244353;
int n, rt, ans, a[N];
inline int Pow(int x, int y)
{
	int res = 1, base = x;
	while(y)
	{
		if(y & 1) res = res * base % mod;
		base = base * base % mod;
		y >>= 1;
	}
	return res;
}
signed main()
{
	freopen("dfs.in", "r", stdin);
	freopen("dfs.out", "w", stdout);
	n = read(), rt = read();
	int inv2 = Pow(2, mod - 2);
	for (int i = 1; i <= n; i++) a[i] = read();
	int x = a[rt]; ans = 0;
	int now = inv2;
	sort(a + 1, a + n + 1);
	for (int i = 1; i <= n; i++) 
		{
			ans = (ans + a[i] * now) % mod;
			if(a[i] == x)
			{
				ans = (ans + a[i] * now) % mod;
			}
			now = now * inv2 % mod;
		} 	
	cout << ans << endl;
	return 0;
}
