#include <bits/stdc++.h>
#define OPEN(_x) freopen(#_x".in", "r", stdin); freopen(#_x".out", "w", stdout)
int n, m;
std::vector<int> chosen;
std::vector<std::vector<int>> res;
void dfs(int a, int b, int c) {
if (b == m && !a) {
res.emplace_back(chosen);
return;
}
for (int i = 1; i <= a; ++ i) if (i >= c) {
chosen.emplace_back(i);
dfs(a - i, b + 1, i);
chosen.pop_back();
}
}
int main() {
OPEN(dataa);
std::cin >> n >> m;
dfs(n, 0, 0);
std::cout << res.size() << '\n';
for (auto i : res) {
for (auto j : i) std::cout << j << ' ';
std::cout << '\n';
}
return 0;
}