#![allow(non_snake_case, unused_imports, unused_must_use)] use std::io::{self, prelude::*}; use std::str; fn main() { let (stdin, stdout) = (io::stdin(), io::stdout()); let mut scan = Scanner::new(stdin.lock()); let mut out = io::BufWriter::new(stdout.lock()); macro_rules! input { ($T: ty) => { scan.token::<$T>() }; ($T: ty, $N: expr) => { (0..$N).map(|_| scan.token::<$T>()).collect::>() }; } let N = input!(usize); let K = input!(usize); let S = input!(String).chars().collect::>(); let mut cnt = 0; let mut ncnt = 0; for i in 0..N { if S[i] == 'N' { if (i >= 1 && S[i - 1] != 'C') || i == 0 { cnt += 1; } ncnt += 1; } } let mut ans = 0; for k in 1..N { if ncnt < K + k { break; } ans += combination::combination(cnt, k); } writeln!(out, "{}", ans % 998_244_353); } pub mod combination { const M: usize = 3 * 100_010; const MOD: usize = 998_244_353; const fn comb() -> ([usize; M], [usize; M], [usize; M]) { let mut f = [0; M]; let mut f_inv = [0; M]; let mut inv = [0; M]; f[0] = 1; f[1] = 1; f_inv[0] = 1; f_inv[1] = 1; inv[1] = 1; let mut i = 2; while i < M { f[i] = (f[i - 1] * i) % MOD; inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD; f_inv[i] = f_inv[i - 1] * inv[i] % MOD; i += 1; } return (f, f_inv, inv); } const _F: [usize; M] = comb().0; const _F_INV: [usize; M] = comb().1; const _INV: [usize; M] = comb().2; /// return nCk % MOD pub const fn combination(n: usize, k: usize) -> usize { if n < k { return 0; } else { return _F[n] * (_F_INV[k] * _F_INV[n - k] % MOD) % MOD; } } /// return n! % MOD pub const fn factorial(n: usize) -> usize { return _F[n]; } } struct Scanner { reader: R, buf_str: Vec, buf_iter: str::SplitWhitespace<'static>, } impl Scanner { fn new(reader: R) -> Self { Self { reader, buf_str: vec![], buf_iter: "".split_whitespace(), } } fn token(&mut self) -> T { loop { if let Some(token) = self.buf_iter.next() { return token.parse().ok().expect("Failed parse"); } self.buf_str.clear(); self.reader .read_until(b'\n', &mut self.buf_str) .expect("Failed read"); self.buf_iter = unsafe { let slice = str::from_utf8_unchecked(&self.buf_str); std::mem::transmute(slice.split_whitespace()) } } } }