#include<iostream>
using namespace std;
int a[2002];
int fige[2002];
int main()
{
int m,h;
while(cin>>m>>h)
{
if(m == 0 && h == 0)
break;
int n;
cin>>n;
int i;
int sum = 0;
int count;
for(i = 1;i <= n;i++)
{
cin>>a[i];
sum += a[i];
}
if(sum > m + h)
{
cout<<"Impossible to distribute"<<endl;
continue;
}
int j;
for(i = 1; i <= n;i++)
{
memset(fige,false,sizeof(fige));
int total = 0;
count = 0;
for(j = i ; j <= n;j++)
{
if(total + a[j] > m)
continue;
fige[j] = true;
total += a[j];
count++;
}
if(sum - total <= h)
break;
}
if(i > n)
cout<<"Impossible to distribute"<<endl;
else
{
cout<<count;
for(i = 1; i <= n;i++)
{
if(fige[i])
cout<<" "<<i;
}
cout<<endl;
}
}
return 0;
}