#include<bits/stdc++.h>
using namespace std;
char hh[1000],ll[1000],p[1000][1000];
int main(){
int a,b;
scanf("%d%d", &a, &b);
for(int i=1;i<=a;i++){
for(int i=0;i<=b;i++){
for(int j=1;j<=b;j++){
p[j][i]=p[j-1][i];
if(i-hh[j]>=0){
if (p[j][i]<p[j-1][i-hh[j]]+ll[j])
p[j][i]=p[j-1][i-hh[j]]+ll[j];
}
}
}
}
cout<<p[b][a];
return 0;
}