#include <bits/stdc++.h>
using namespace std;using ll=long long;using uint=unsigned int;using pii=pair<int,int>;using pll=pair<ll,ll>;using ull = unsigned long long;using ld=long double;template<typename T>void _(const char*s,T h){cerr<<s<<" = "<<h<<"\n";}template<typename T,typename...Ts>void _(const char*s,T h,Ts...t){int b=0;while(((b+=*s=='(')-=*s==')')!=0||*s!=',')cerr<<*s++;cerr<<" = "<<h<<",";_(s+1,t...);}// break continue pop_back 998244353
#define int ll
#define pii pll
#define f first
#define s second
#define pb emplace_back
#define forn(i,n) for(int i=0;i<(n);++i)
#define sz(a)((int)(a).size())
#define sqr(x) ((x)*(x))
struct init{init(){cin.tie(0);iostream::sync_with_stdio(0);cout<<fixed<<setprecision(10);cerr<<fixed<<setprecision(5);}~init(){
#ifdef LOCAL
#define dbg(...) _(#__VA_ARGS__,__VA_ARGS__)
cerr<<"Time elapsed: "<<(double)clock()/CLOCKS_PER_SEC<<"s.\n";
#else
#define dbg(...) 
#endif
}}init;template<typename T,typename U>void upx(T&x,U y){if(x<y)x=y;}template<typename T,typename U>void upn(T&x,U y){if(x>y)x=y;}mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());const int D=4,dx[]={+1,0,-1,0},dy[]={0,+1,0,-1};
const int32_t M=998244353;
int32_t rev(int32_t x,int32_t m){
    if(x==1)return 1;
    return (1-(ll)rev(m%x,x)*m)/x+m;
}
struct mint{
    int32_t x;
    mint():x(0){}
    mint(int32_t xx):x(xx%M){if(x<0)x+=M;}
    mint(ll xx):x(xx%M){if(x<0)x+=M;}
    mint& operator+=(mint b){if((x+=b.x)>=M)x-=M;return *this;}
    mint operator+(mint b){mint res=*this;res+=b;return res;}
    mint& operator-=(mint b){if((x-=b.x)<0)x+=M;return *this;}
    mint operator-(mint b){mint res=*this;res-=b;return res;}
    mint& operator*=(mint b){x=(ll)x*b.x%M;return *this;}
    mint operator*(mint b){mint res=*this;res*=b;return res;}
    mint inverse(){return rev(x,M);}
    mint& operator/=(mint b){x=(ll)x*rev(b.x,M)%M;return *this;}
    mint operator/(mint b){mint res=*this;res/=b;return res;}
    mint operator^(ll w) {mint r=1,a=*this;while(w){if(w&1)r*=a;a*=a;w/=2;}return r;}
    mint operator^=(ll w){return *this=(*this)^w;}
    mint operator^(mint w){return *this^w.x;}
    mint operator^=(mint w){return *this=(*this)^w;}
    mint operator-()const{return mint()-*this;}
    explicit operator bool()const{return x;}
};
istream&operator>>(istream&is,mint&p){istream&res=is>>p.x;p.x%=M;return res;}
ostream&operator<<(ostream&os,mint p){return os<<p.x;}
template<typename T>mint operator+(T x,mint y){return mint(x)+y;}
template<typename T>mint operator-(T x,mint y){return mint(x)-y;}
template<typename T>mint operator*(T x,mint y){return mint(x)*y;}
template<typename T>mint operator/(T x,mint y){return mint(x)/y;}
template<typename T>mint operator^(T x,mint y){return mint(x)^y;}
mint abs(mint x){return x;}

const int N=2e5+5;
mint t[N];
mint get(int i){
    mint res=0;
    for(;i>=0;i=(i&(i+1))-1)res+=t[i];
    return res;
}
void add(int i,mint x){for(;i<N;i|=i+1)t[i]+=x;}
int a[N];
mint ri[N];
mint invri[N];
int32_t main(){
	int n,k;
	cin>>n>>k;
	ri[0]=1;
	invri[0]=1;
	mint r=((mint)k-1)/k;
	mint invr=1/r;
	for(int i=1;i<=n;++i){
		cin>>a[i];
		ri[i]=ri[i-1]*r;
		invri[i]=invri[i-1]*invr;
	}
	mint inv=0;
	for(int i=n;i>=1;--i){
		inv+=get(a[i]);
		add(a[i],1);
	}
	memset(t,0,sizeof t);
	mint canadd=0;
	for(int i=1;i<=n;++i){
		canadd+=get(a[i])*ri[max(i,k)];
		add(a[i],invri[max(i,k)]);
	}
	memset(t,0,sizeof t);
	for(int i=1;i<=n;++i){
		int x=n-a[i]+1;
		canadd-=get(x)*ri[max(i,k)];
		add(x,invri[max(i,k)]);
	}
	canadd/=2;
	cout<<inv+canadd<<'\n';
    return 0;
}

### Prompt

Your challenge is to write a cpp solution to the following problem:

Given are a permutation p_1, p_2, \dots, p_N of (1, 2, ..., N) and an integer K. Maroon performs the following operation for i = 1, 2, \dots, N - K + 1 in this order:

* Shuffle p_i, p_{i + 1}, \dots, p_{i + K - 1} uniformly randomly.



Find the expected value of the inversion number of the sequence after all the operations are performed, and print it modulo 998244353.

More specifically, from the constraints of this problem, it can be proved that the expected value is always a rational number, which can be represented as an irreducible fraction \frac{P}{Q}, and that the integer R that satisfies R \times Q \equiv P \pmod{998244353}, 0 \leq R < 998244353 is uniquely determined. Print this R.

Here, the inversion number of a sequence a_1, a_2, \dots, a_N is defined to be the number of ordered pairs (i, j) that satisfy i < j, a_i > a_j.

Constraints

* 2 \leq N \leq 200,000
* 2 \leq K \leq N
* (p_1, p_2, \dots, p_N) is a permutation of (1, 2, \dots, N).
* All values in input are integers.

Input

Input is given from Standard Input in the following format:


N K
p_1 p_2 ... p_N


Output

Print the expected value modulo 998244353.

Examples

Input

3 2
1 2 3


Output

1


Input

10 3
1 8 4 9 2 3 7 10 5 6


Output

164091855

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;using ll=long long;using uint=unsigned int;using pii=pair<int,int>;using pll=pair<ll,ll>;using ull = unsigned long long;using ld=long double;template<typename T>void _(const char*s,T h){cerr<<s<<" = "<<h<<"\n";}template<typename T,typename...Ts>void _(const char*s,T h,Ts...t){int b=0;while(((b+=*s=='(')-=*s==')')!=0||*s!=',')cerr<<*s++;cerr<<" = "<<h<<",";_(s+1,t...);}// break continue pop_back 998244353
#define int ll
#define pii pll
#define f first
#define s second
#define pb emplace_back
#define forn(i,n) for(int i=0;i<(n);++i)
#define sz(a)((int)(a).size())
#define sqr(x) ((x)*(x))
struct init{init(){cin.tie(0);iostream::sync_with_stdio(0);cout<<fixed<<setprecision(10);cerr<<fixed<<setprecision(5);}~init(){
#ifdef LOCAL
#define dbg(...) _(#__VA_ARGS__,__VA_ARGS__)
cerr<<"Time elapsed: "<<(double)clock()/CLOCKS_PER_SEC<<"s.\n";
#else
#define dbg(...) 
#endif
}}init;template<typename T,typename U>void upx(T&x,U y){if(x<y)x=y;}template<typename T,typename U>void upn(T&x,U y){if(x>y)x=y;}mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());const int D=4,dx[]={+1,0,-1,0},dy[]={0,+1,0,-1};
const int32_t M=998244353;
int32_t rev(int32_t x,int32_t m){
    if(x==1)return 1;
    return (1-(ll)rev(m%x,x)*m)/x+m;
}
struct mint{
    int32_t x;
    mint():x(0){}
    mint(int32_t xx):x(xx%M){if(x<0)x+=M;}
    mint(ll xx):x(xx%M){if(x<0)x+=M;}
    mint& operator+=(mint b){if((x+=b.x)>=M)x-=M;return *this;}
    mint operator+(mint b){mint res=*this;res+=b;return res;}
    mint& operator-=(mint b){if((x-=b.x)<0)x+=M;return *this;}
    mint operator-(mint b){mint res=*this;res-=b;return res;}
    mint& operator*=(mint b){x=(ll)x*b.x%M;return *this;}
    mint operator*(mint b){mint res=*this;res*=b;return res;}
    mint inverse(){return rev(x,M);}
    mint& operator/=(mint b){x=(ll)x*rev(b.x,M)%M;return *this;}
    mint operator/(mint b){mint res=*this;res/=b;return res;}
    mint operator^(ll w) {mint r=1,a=*this;while(w){if(w&1)r*=a;a*=a;w/=2;}return r;}
    mint operator^=(ll w){return *this=(*this)^w;}
    mint operator^(mint w){return *this^w.x;}
    mint operator^=(mint w){return *this=(*this)^w;}
    mint operator-()const{return mint()-*this;}
    explicit operator bool()const{return x;}
};
istream&operator>>(istream&is,mint&p){istream&res=is>>p.x;p.x%=M;return res;}
ostream&operator<<(ostream&os,mint p){return os<<p.x;}
template<typename T>mint operator+(T x,mint y){return mint(x)+y;}
template<typename T>mint operator-(T x,mint y){return mint(x)-y;}
template<typename T>mint operator*(T x,mint y){return mint(x)*y;}
template<typename T>mint operator/(T x,mint y){return mint(x)/y;}
template<typename T>mint operator^(T x,mint y){return mint(x)^y;}
mint abs(mint x){return x;}

const int N=2e5+5;
mint t[N];
mint get(int i){
    mint res=0;
    for(;i>=0;i=(i&(i+1))-1)res+=t[i];
    return res;
}
void add(int i,mint x){for(;i<N;i|=i+1)t[i]+=x;}
int a[N];
mint ri[N];
mint invri[N];
int32_t main(){
	int n,k;
	cin>>n>>k;
	ri[0]=1;
	invri[0]=1;
	mint r=((mint)k-1)/k;
	mint invr=1/r;
	for(int i=1;i<=n;++i){
		cin>>a[i];
		ri[i]=ri[i-1]*r;
		invri[i]=invri[i-1]*invr;
	}
	mint inv=0;
	for(int i=n;i>=1;--i){
		inv+=get(a[i]);
		add(a[i],1);
	}
	memset(t,0,sizeof t);
	mint canadd=0;
	for(int i=1;i<=n;++i){
		canadd+=get(a[i])*ri[max(i,k)];
		add(a[i],invri[max(i,k)]);
	}
	memset(t,0,sizeof t);
	for(int i=1;i<=n;++i){
		int x=n-a[i]+1;
		canadd-=get(x)*ri[max(i,k)];
		add(x,invri[max(i,k)]);
	}
	canadd/=2;
	cout<<inv+canadd<<'\n';
    return 0;
}

```