mod mod_int { pub trait ModInt { fn mod_add(self, other: Self) -> Self; fn mod_add_assign(&mut self, other: Self); fn mod_sub_with(self, other: Self, m: Self) -> Self; fn mod_sub(self, other: Self) -> Self; fn mod_mul_with(self, other: Self, m: Self) -> Self; fn mod_mul(self, other: Self) -> Self; fn mod_pow_with(self, exp: Self, m: Self) -> Self; fn mod_pow(self, exp: Self) -> Self; fn mod_inv(self) -> Self; } macro_rules! impl_mod_int { ($t:ty, $m:expr) => { impl ModInt for $t { fn mod_add(self, other: Self) -> Self { assert!(self < $m); assert!(other < $m); let result = self + other; if result < $m { result } else { result - $m } } fn mod_add_assign(&mut self, other: Self) { *self = (*self).mod_add(other); } fn mod_sub_with(self, other: Self, m: Self) -> Self { assert!(self < m); assert!(other < m); if self < other { self + m - other } else { self - other } } fn mod_sub(self, other: Self) -> Self { self.mod_sub_with(other, $m) } fn mod_mul_with(self, other: Self, m: Self) -> Self { assert!(self < m); assert!(other < m); self * other % m } fn mod_mul(self, other: Self) -> Self { self.mod_mul_with(other, $m) } fn mod_pow_with(mut self, mut exp: Self, m: Self) -> Self { assert!(self < m); let mut acc = 1; while exp > 0 { if exp & 1 == 1 { acc = acc.mod_mul_with(self, m); } self = self.mod_mul_with(self, m); exp /= 2; } acc } fn mod_pow(self, exp: Self) -> Self { self.mod_pow_with(exp, $m) } fn mod_inv(self) -> Self { assert!(self < $m); self.mod_pow($m - 2) } } }; } impl_mod_int!(u64, 1_000_000_007); } use mod_int::ModInt; fn run<'a, F: FnMut() -> &'a str, W: std::io::Write>(scan: &mut F, writer: &mut W) { macro_rules! scan { ([$t:tt; $n:expr]) => ((0..$n).map(|_| scan!($t)).collect::>()); (($($t:tt),*)) => (($(scan!($t)),*)); (Usize1) => (scan!(usize) - 1); (Bytes) => (scan().as_bytes().to_vec()); ($t:ty) => (scan().parse::<$t>().unwrap()); } macro_rules! println { ($($arg:tt)*) => (writeln!(writer, $($arg)*).ok()); } let (n, k) = scan!((u64, u64)); let r = 2u64.mod_pow_with(k - 1, n); let q = 2u64.mod_pow(k - 1).mod_sub(r).mod_mul(n.mod_inv()); let mut ans = vec![0; n as usize]; for i in 0..n { ans[((2 * i + 1) % n) as usize].mod_add_assign(q); } for i in 0..r { ans[((2 * i + 1) % n) as usize].mod_add_assign(1); } let tmp = ans.clone(); for i in 0..n { ans[0u64.mod_sub_with(i, n) as usize].mod_add_assign(tmp[i as usize]); } let d = 2u64.mod_inv().mod_pow(k); for ans in ans { println!("{}", ans.mod_mul(d)); } } fn main() { let ref mut buf = Vec::new(); std::io::Read::read_to_end(&mut std::io::stdin(), buf).ok(); let mut scanner = unsafe { std::str::from_utf8_unchecked(buf).split_ascii_whitespace() }; let ref mut scan = || scanner.next().unwrap(); let stdout = std::io::stdout(); let ref mut writer = std::io::BufWriter::new(stdout.lock()); run(scan, writer); }