#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
int n,m;
string a,b;
cin>>n>>m;
cin>>a>>b;
sort(b.begin(),b.end(),greater<int>());
cout<<b<<endl;
string::iterator k=b.begin();
cout<<*k;
vector<int>::iterator k;
}