#include <iostream>
using namespace std;
int many, big,num[10];
void dg(int now){
if(now==big+1){
for(int i=1;i<=big;i++){
cout<<num[i];
}
cout<<endl;
return;
for(int i=1;i<=many;i++){
num[now]=i;
//cout<<now<<i<<endl;
dg(now+1);
int main()
{
cin >> many >> big;
dg(1);