// 1111111.cpp : Defines the entry point for the console application.
//
#include "stdio.h"

int _tmain()
{
		 int m,n;
	 int i,j;
	int a[1000], b[1000];
	int c = 0;
			int max=0;
		int maxCount = 0;
	int min=0,minCount=0;
	scanf_s("%ld%ld",&m,&n);
	for( i=0; i<n; i++)
		scanf_s("%d",&a[i]);
	for( i=0; i<n; i++)
		b[i] = i + 1;
	for(i=0;i<n;i++)
		for(j=0;j<n-i-1;j++)
			if (a[j]<a[j+1]) {c = a[j]; a[j]=a[j+1]; a[j+1]=c; c=b[j]; b[j]=b[j+1]; b[j+1]=c;}
	c=0;
	if (m<=a[0]) {printf("1\n%d",b[0]);} else {
		for( i=0; i<n; i++)
			a[i]--;
		for( i=0; i<n; i++) {
			m = m - a[i];
			if (m<=0) {c=i+1; break;}
		}
		if (c>0) {
		printf("%d",c);
		for( i=0; i<c; i++)
			printf("%d",b[i]);
		} else {
			printf("Epic fail");
		}
	}
	return 0;
}