#include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b){
    if (a == 0 || b == 0){
        return a + b;
    }
    while (a*b != 0){ 
        if (a > b){
            a %= b;
        }else{
            b %= a;
        }
    }
    return a + b; 
}

struct T 
{
	double tuso,mauso,ketqua; 
}q[1000000];
bool lf(T x,T y)
{
	return x.ketqua<y.ketqua;
}

int main ()
{
	freopen ("BAI1_13.inp", "r", stdin);
	freopen ("BAI1_13.out", "w", stdout);
	int c,d,e=1;
	cin>>c>>d;
	q[0].tuso=0; q[0].mauso=1; q[0].ketqua=0;
	q[1].tuso=1; q[1].mauso=1; q[1].ketqua=1;
	for (int i=2; i<=c; i++)
		for (int j=1; j<i; j++)
			if (gcd(i,j)==1)
			{
				e++;
				q[e].tuso=j; 
				q[e].mauso=i; 
				q[e].ketqua=q[e].tuso/q[e].mauso;
			}
	sort (q, q+e,lf);
	cout <<e+1 << endl ; 
	if (d>e+1) cout << -1; else 
	cout<< q[d-1].tuso << q[d-1].mauso;
}
