#include <bits/stdc++.h>
using namespace std;
int l, p;
vector<vector<char>>v;
void build(int dv, int idx, int val) {
//cout<<idx<<endl;
if (idx <0 || idx > (1<<(p-1)))
return;
for(int i = 0; i<val; ++i)
v[idx].push_back('-');
if (val == 1)
return;
build(dv/2, idx-dv/2, val-1);
build(dv/2, dv/2+idx, val-1);
}
int main() {
cin>>l>>p;
if (p == 1) {
for (int i = 0; i<=l; ++i) {
cout<<"-"<<i<<endl;
}
return 0;
}
int x = (1<<(p-1));
v.resize(x);
build(x/2, x/2,p-1);
for (int i = 0; i<l; ++i) {
for (int j = 0; j<p; ++j)
cout<<"-";
cout<<i;
for (int j = 0; j<v.size(); ++j) {
for(auto r : v[j]) {
cout<<r;
}
puts("");
}
}
for (int j = 0; j<p; ++j)
cout<<"-";
cout<<l;
puts("");
return 0;
}
Copy