#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <fstream>
#include <set>
#include <utility>
#include <algorithm>
#include <queue>
#include <stack>
#include <deque>
#include <numeric>
#include <sstream>
#include <list>
#include <map>

#define rep(i,p,n) for(int i=(int)p;i<(int)n;i++)
#define repp(i,p,n) for(int i=(int)p;i>=(int)n;i--)
#define Sort(x) sort(x.begin(),x.end());
#define ll long long 
#define vi vector<int>
#define vvi vector<vector<int>>
#define vvvi <vector<vector<vector<int>>> 
#define vc vector<char> 
#define vvc vector<vector<char>>
#define vvvc vector<vector<vector<char>>> 
#define INF 2000000000

using namespace std;

int main() {
	while (1) {
		int n;
		cin >> n;
		if (n == 0)break;

		vector<int> v(10,0);
		for (int i = 0; i < n; i++) {
			int x;
			cin >> x; 
			v[x]++;
		}

		for (int i = 0; i < 10; i++) {
			if (v[i] != 0) {
				for (int j = 0; j < v[i]; j++) cout << "*";
				cout << endl;
			}
			else cout << "-" << endl;
		}
	}

	

	


	return 0;
}
#include <bits/stdc++.h>
using namespace std;
const int dx[]={1,0,0,-1,1,-1,-1,1,2,0,-2,0};
const int dy[]={0,1,-1,0,1,1,-1,-1,0,2,0,-2};
const int INF = 1<<30;
const double EPS = 1e-8;
#define PB push_back
#define mk make_pair
#define fr first
#define sc second
#define reps(i,j,k) for(int i = (j); i < (k); ++i)
#define rep(i,j) reps(i,0,j)
#define MOD 1000000007
#define lengthof(x) (sizeof(x) / sizeof(*(x)))
typedef pair<int,int> Pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef long long ll;
int main(){
	int N,Q;
	while(scanf("%d%d",&N,&Q),(N|Q)){
		int s[128]={0};
		int length = 0;
		rep(i,N){
			int c;
			scanf("%d",&c);
			rep(j,c){
				int t;
				scanf("%d",&t);
				s[t]++;
				length = max(length,t);
			}
		}
		length++;
		int ans = 0;
		int index = 0;
		rep(i,length){
			if(s[i]>=Q && ans < s[i]){
				ans = s[i];
				index = i;
			}
		}
		printf("%d\n",index);
	}
	return 0;
}