#include <stdio.h>
#include <stdlib.h>
#include <map>
#include <list>

int summ(std::map<int, int> lst);
std::list<int> swap(std::list<int> list, int i, int k);
bool check(std::list<int>, int l);

int main(int argc, char* argv[])
{
	int N(0),M(0);
	scanf("%d %d", &N, &M);
	int* hubs =  new int[M];
	for(int i = 0; i < M; i++)
		scanf("%d",&hubs[i]);
	int sum = 0;
	std::map<int,int> lst;
	std::map<int,int> lst2;
	std::list<int> stk;
	int max;
	int p = -1;
	while(summ(lst) < N && p !=	M-1)
	{
		p++;
		max = 0;
		stk.push_back(-1);
		for(int i = 0; i < M; i++)
		{
			if(hubs[i] >= max && check(stk, i))
			{
				max = hubs[i];
				lst[p] = hubs[i];
				if(!stk.empty())
					stk.pop_back();
				stk.push_back(i);
			}
		}			
	}
	if(summ(lst) < N)
	{
			printf("Epic fail\n");
			return 0;
	}
	lst2 =lst;
	for(int i = 0; i < lst.size(); i++)
	{
		for(int k = 0; k < M; k++)
		{
			if(hubs[k] < lst[i])
			{
				lst2[i] = hubs[k];
				if(summ(lst2) >= N)
				{
					lst = lst2;
					swap(stk, i, k);
				}
				else
					lst2 = lst;
			}
		}
	}
	printf("%d\n", lst.size());
	for(int i = stk.size(); i > 0; i--)
	{
		printf("%d ", stk.front() + 1);
		stk.pop_front();
	}
	printf("\n");
	return 0;
}

int summ(std::map<int, int> lst)
{
	if(lst.empty())
		return 0;
	int sum = 0;
	for(int i = 0; i < lst.size(); i++)
		sum += lst[i];
	sum -= (lst.size()-1)*2;
	return sum;
}

std::list<int> swap(std::list<int> list, int i, int k)
{
	std::list<int> new1;
	while(list.front() != i)
	{
		new1.push_back(list.front());
		list.pop_front();
	}
	new1.push_back(k);
	while(!list.empty())
	{
		new1.push_back(list.front());
		list.pop_front();
	}
	return new1;
}

bool check(std::list<int> list, int l)
{
	if(list.empty())
		return true;
	while(list.back() != l)
	{		
		list.pop_back();
		if(list.empty())
			return true;
	}
	return false;
}