Amr is a young coder who likes music a lot. He always wanted to learn how to play music but he was busy coding so he got an idea.Amr has n instruments, it takes ai days to learn i-th instrument. Being busy, Amr dedicated k days to learn how to play the maximum possible number of instruments.Amr asked for your help to distribute his free days between instruments so that he can achieve his goal.

The first line contains two numbers n, k (1 ≤ n ≤ 100, 0 ≤ k ≤ 10 000), the number of instruments and number of days respectively. The second line contains n integers ai (1 ≤ ai ≤ 100), representing number of days required to learn the i-th instrument.

In the first line output one integer m representing the maximum number of instruments Amr can learn. In the second line output m space-separated integers: the indices of instruments to be learnt. You may output indices in any order. if there are multiple optimal solutions output any. It is not necessary to use all days for studying.

NoteIn the first test Amr can learn all 4 instruments.In the second test other possible solutions are: {2, 3, 5} or {3, 4, 5}.In the third test Amr doesn't have enough time to learn the only presented instrument.

import java.util.ArrayList;
import java.util.Scanner;

/**
 * Created by Baka on 23.05.2016.
 */
public class AmrAndMusic {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int k = scanner.nextInt();

//        int[] a = new int[n];
        Day[] a = new Day[n];
        for (int i = 0; i < a.length; i++) {
            a[i] = new Day(i, scanner.nextInt());
        }

        sort(a);

        int cnt = 0;

        for (int i = 0; i < a.length; i++){
            if (k - a[i].days >= 0){
                cnt++;
                k -= a[i].days;
            } else break;
        }

        System.out.println(cnt);

        for (int i = 0; i < cnt; i++){
            System.out.print(a[i].index + 1 + " ");
        }

    }

    static class Day{
        int index;
        int days;

        Day(int index, int days){
            this.index = index;
            this.days = days;
        }
    }

    static void sort(Day[] a) {
        sort(a, 0, a.length - 1);
    }

    static void sort(Day[] a, int startIndex, int endIndex) {
        if (endIndex <= startIndex) return;
        int pivot = partition(a, startIndex, endIndex);
        sort(a, startIndex, pivot - 1);
        sort(a, pivot + 1, endIndex);
    }

    static int partition(Day[] a, int startIndex, int endIndex) {
        int i = startIndex, j = endIndex + 1;

        while (true) {
            while (a[++i].days < a[startIndex].days)
                if (i == endIndex) break;
            while (a[--j].days > a[startIndex].days)
                if (j == startIndex) break;

            if (i >= j) break;

            swap(a, i, j);

        }
        swap(a, startIndex, j);
        return j;
    }

    static int partitionLomutos(Day[] a, int startIndex, int endIndex) {
        int pointer = startIndex;

        for (int i = startIndex; i < endIndex; i++) {
            if (a[i].days <= a[endIndex].days) {
                swap(a, i, pointer);
                pointer++;
            }
        }
        swap(a, pointer, endIndex);
        return pointer;
    }

    static void swap(Day[] a, int i1, int i2) {
        Day t = a[i1];
        a[i1] = a[i2];
        a[i2] = t;
    }

}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Scanner;
import java.util.Comparator;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskA solver = new TaskA();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskA {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int n = in.nextInt();
            int k = in.nextInt();
            int[][] a = new int[n][2];
            for (int i = 0; i < n; ++i) {
                a[i][0] = in.nextInt();
                a[i][1] = i + 1;
            }
            Arrays.sort(a, new Comparator<int[]>() {

                public int compare(int[] ints, int[] t1) {
                    return ints[0] - t1[0];
                }
            });
            int count = 0;
            int res = 0;
            for (int i = 0; i < n; ++i) {
                count += a[i][0];
                if (count > k) break;
                ++res;
            }
            out.println(res);
            for (int i = 0; i < res; ++i) {
                out.print(a[i][1] + " ");
            }
        }

    }
}

import java.io.FileNotFoundException;
import java.util.NoSuchElementException;
import java.util.Arrays;
import java.util.Scanner;
import java.io.File;
//import java.util.*;
//import java.io.*;

public class HelloWorld {
    public static void main(String[] args) { ////throws FileNotFoundException {
        //int N = System.in();
        //int T = System.in();

        //System.out.println(new File("test_input.txt.txt").getAbsoluteFile());

        ///*
        Scanner in = new Scanner(System.in);

        ////File file = new File("./resources/test_input.txt"); //./src/test_input.txt");
        ////in = new Scanner(file);

        String A = in.next();
        int N = Integer.parseInt(A);
        String B = in.next();
        int T = Integer.parseInt(B);

        int[] instrum = new int[N];

        String C;
        int D;
        for (int i = 0; i < N; i++) {
            C = in.next();
            D = Integer.parseInt(C);
            instrum[i] = D;
        }

        String[] lowest = new String[101];
        int minimum;
        int index = 0;
        int count = 0;
        while (T >= 0) {
            minimum = 10001;
            for (int j = 0; j < N; j++) {
                //System.out.println(instrum[j]);
                if (instrum[j] < minimum) {
                    minimum = instrum[j];
                    index = j;
                }
            }
            instrum[index] = 10001;
            T -= minimum;
            if (T >= 0) {
                lowest[count] = Integer.toString(index+1);
                count++;
            }
        }

        System.out.println(count);

        //WHILE THE VALUE IS NOT ZERO, PRINT OUT EVERY VALUE OF LOWEST ARRAY
        for (int k = 0; k < 101; k++){
            if (lowest[k] != null) {
                System.out.print(lowest[k]+" ");
            } else {
                break;
            }
        }
        System.out.println();
        in.close();
        //*/
    }
}

import java.util.Arrays;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.IOException;
import java.util.StringTokenizer;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskA solver = new TaskA();
        solver.solve(1, in, out);
        out.close();
    }
}

class TaskA {
    public void solve(int testNumber, InputReader in, PrintWriter out) {
        int n = in.nextInt();
        int k = in.nextInt();
        Instruments[] a = new Instruments[n];
        for (int i = 0; i < n; i++) {
            a[i] = new Instruments(in.nextInt(),i+1);
        }
        Arrays.sort(a);
        int res = 0;
        for(int i = 0; i < n && k - a[i].cost >= 0; ++i){
            k -= a[i].cost;
            ++res;
        }
        out.println(res);
        for (int i = 0; i < res; i++) {
            out.printf("%d ",a[i].index);
        }
    }
}

class Instruments implements Comparable<Instruments>{
    int cost;
    int index;

    public Instruments(int cost, int index) {
        this.cost = cost;
        this.index = index;
    }

    public int compareTo(Instruments o) {
        return this.cost - o.cost;
    }
}

class InputReader {
    public BufferedReader reader;
    public StringTokenizer tokenizer;

    public InputReader(InputStream stream) {
        reader = new BufferedReader(new InputStreamReader(stream), 32768);
        tokenizer = null;
    }

    public String next() {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(reader.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken();
    }

    public int nextInt() {
        return Integer.parseInt(next());
    }

}

import java.util.Arrays;
import java.util.Scanner;

public class music {
    public static void main(String[] args) {
        int n,m=0,max=0,flag=0;
        int ind=0;
        String nk[];
        String a="";
        long k;
        Scanner In = new Scanner(System.in);
        String input1=In.nextLine();
        String input2=In.nextLine();
        nk=input1.split(" ");
        n=Integer.parseInt(nk[0]);
        k=Integer.parseInt(nk[1]);
        nk=input2.split(" ");
        int[] q =new int[nk.length];
        for(int i=0;i<nk.length;i++){
            q[i]=Integer.parseInt(nk[i]);

        }
         Arrays.sort(q);
         int[] f=new int[nk.length];
        Arrays.fill(f, 0);
        for (int i =0;i<q.length;i++){
            max=max+q[i];
            if(max>k){
                System.out.println(m);
                System.out.println(a);
                flag=1;
                break;
            }
            else{
                m++;
                for(int j=0;j<nk.length;j++){
                    if(q[i]==Integer.parseInt(nk[j])&&f[j]==0){
                        ind=j+1;
                        f[j]=1;
                        break;
                    }

                }
                a=a+ind+" ";

            }
        }
        if(flag==0){
            System.out.println(m);
            System.out.println(a);
        }

    }

}

import java.util.Scanner;
import java.util.Arrays;
import java.lang.StringBuffer;

public class Main {
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        StringBuffer sb = new StringBuffer();
        int n = s.nextInt(), t = s.nextInt(), d = 0;
        double l[] = new double[++n];
        for(int i = 1; i < n; i++) {
            l[i] = (double)s.nextInt() + (i / 100000.0);
        }
        Arrays.sort(l);
        for(int i = 1; i < n; i++) {
            d += (int)l[i];
            if(d <= t) {
                int j = (int)((l[i]-(int)l[i])*100000+0.000001);
                sb.append(j+" ");
            } else {
                System.out.println(i-1);
                System.out.print(sb);
                return;
            }
        }
        System.out.println(n-1);
        System.out.print(sb);
    }
}

import java.util.*;

public class A {

	public static void main (String args[]) {
		List<Integer> a = new ArrayList<Integer>();
		List<Integer> b = new ArrayList<Integer>();
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		int k = in.nextInt();
		int s = 0;
		int m = 0;
		for(int i=0; i<n; i++) {
			int t = in.nextInt();
			a.add(t);
			b.add(t);
		}
		Collections.sort(a);
		for(int i=0; i<n; i++) {
				if(s+a.get(i)<=k) {
				s+=a.get(i);
				m++;
			} else {
				break;
			}
		}
		System.out.println(m);
		for(int i=0;i<m;i++) {
			System.out.printf("%d ",b.indexOf(a.get(i))+1);
			b.set(b.indexOf(a.get(i)),0);
		}

	}
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;

public class Main
{
    static class Point implements Comparable<Point>{
        int indices;
        int value;
        public Point(int indices,int value)
        {
            this.indices=indices;
            this.value=value;
        }

        @Override
        public int compareTo(Point o) {
            return this.value-o.value;
        }
    }
    public static void main(String ab[]) throws IOException
    {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
       String line[];
        line=br.readLine().split(" ");
        int n=Integer.parseInt(line[0]);
        int k=Integer.parseInt(line[1]);
        Point point[] = new Point[n];
        line=br.readLine().split(" ");
        for (int i = 0; i < n; i++) {
            point[i]=new Point(i,Integer.parseInt(line[i]));
        }
        Arrays.sort(point);
        int count=0;
        for (int i = 0; i < n; i++) {
           if(k>=point[i].value)
           {
               k-=point[i].value;
               count++;
           }
        }
        System.out.println(count);
        for (int i = 0; i < count; i++) {
           System.out.print(point[i].indices+1+" ");
        }
    }
}

import java.io.*;    //PrintWriter
import java.math.*;  //BigInteger, BigDecimal
import java.util.*;  //StringTokenizer, ArrayList

public class R287_Div2_A
{
	FastReader in;
	PrintWriter out;

	public static void main(String[] args)  {
		new R287_Div2_A().run();
	}

	void run()
	{
		in = new FastReader(System.in);
		out = new PrintWriter(System.out);
		solve();
		out.close();
	}

	void solve()
	{
		int n = in.nextInt();
		int k = in.nextInt();

		int[] a = new int[n];
		int[] b = new int[n];
		for (int i = 0; i < n; i++)
		{
			a[i] = in.nextInt();
			b[i] = i+1;
		}

		//Arrays.sort(a);
		for (int i = 0; i < n; i++)
			for (int j = i+1; j < n; j++)
				if (a[i] > a[j])
				{
					int t = a[i]; a[i] = a[j]; a[j] = t;
					t = b[i]; b[i] = b[j]; b[j] = t;
				}

		int sum = 0, cnt = 0;
		String s = "";
		for (int i = 0; i < n; i++)
			if (sum + a[i] <= k)
			{
				cnt++;
				s += b[i] + " ";
				sum += a[i];
			}
			else
				break;

		out.println(cnt);
		if (cnt > 0) out.println(s);
	}

	//-----------------------------------------------------
	void runWithFiles() {
		in = new FastReader(new File("input.txt"));
		try {
			out = new PrintWriter(new File("output.txt"));
		}
		catch (FileNotFoundException e) {
			e.printStackTrace();
		}
		solve();
		out.close();
	}

	class FastReader
	{
	    BufferedReader br;
	    StringTokenizer tokenizer;

	    public FastReader(InputStream stream)
	    {
	        br = new BufferedReader(new InputStreamReader(stream));
	        tokenizer = null;
	    }
		public FastReader(File f) {
			try {
				br = new BufferedReader(new FileReader(f));
				tokenizer = null;
			}
			catch (FileNotFoundException e) {
				e.printStackTrace();
			}
		}

	    private String next() {
	        while (tokenizer == null || !tokenizer.hasMoreTokens())
	            try {
	            	tokenizer = new StringTokenizer(br.readLine());
	            }
	            catch (IOException e) {
	                throw new RuntimeException(e);
	            }
	        return tokenizer.nextToken();
	    }
		public String nextLine() {
			try	{
				return br.readLine();
			}
			catch(Exception e) {
				throw(new RuntimeException());
			}
		}

	    int nextInt() {
	        return Integer.parseInt(next());
	    }
	    long nextLong() {
	        return Long.parseLong(next());
	    }
	    double nextDouble() {
	        return Double.parseDouble(next());
	    }
	    BigInteger nextBigInteger() {
	        return new BigInteger(next());
	    }
	    BigDecimal nextBigDecimal() {
	        return new BigDecimal(next());
	    }
	}
}

import java.util.Arrays;
import java.util.Scanner;

public class AmrAndMusic {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int instruments = in.nextInt();
        int days = in.nextInt();
        int[] learn = new int[instruments+1];
        int[] inpos = new int[instruments+1];

        for(int i=1; i<=instruments; i++) {
            learn[i] = in.nextInt();
        }
        inpos = Arrays.copyOf(learn, learn.length);

        Arrays.sort(learn);

        int j = 1;
        int count = 0;
        String result = "";
        while(days>0 && j < learn.length) {
            int got = learn[j];
            if(got <= days) {
                count++;
                days -= got;

                for(int k=1; k<inpos.length; k++) {
                    if(inpos[k] == got) {
                        result += (k + " ");
                        inpos[k] = -1;
                        break;
                    }
                }
            } else {
                break;
            }
            j++;
        }
        System.out.println(count);
        System.out.println(result.trim());

    }

}

import java.util.Arrays;
import java.util.Comparator;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int N = in.nextInt();
		int K = in.nextInt();
		Pair[] array = new Pair[N];
		for (int i = 0; i < array.length; i++) {
			array[i] = new Pair(in.nextInt(), i+1);
		}
		Arrays.sort(array, new Comparator<Pair>() {
			@Override
			public int compare(Pair o1, Pair o2) {
				return Integer.valueOf(o1.x).compareTo(o2.x);
			}
		});

		int max = 0;
		while (max < array.length && array[max].x <= K) {
			K -= array[max++].x;
		}
		System.out.println(max);
		for (int i = 0; i <= max - 2; i++) {
			System.out.print(array[i].y + " ");
		}
		if (max-1 < array.length && max - 1 >= 0) {
			System.out.println(array[max - 1].y);
		}
	}

	static class Pair {
		int x, y;
		public Pair(int x, int y) {
			this.x = x;
			this.y = y;
		}
	}
}

import java.io.*;
import java.util.*;
public class amr_and_music
{
	public static void main(String[] args) throws NumberFormatException, IOException
	{
		PrintWriter out=new PrintWriter(System.out);
		fastscanner fs=new fastscanner();
		int input[]=new int[2];
		fs.readArray(input);
		int n=input[0],c=0,s=0;
		int x=input[1],index=0;
		int arr[]=new int[n];
		int second[]=new int[n];
		fs.readArray(arr);
		for(int i:arr)
		{
			second[index]=i;
			index++;
		}
		fs.sort(arr);
		for(int i=0;i<n;i++)
		{
			s=s+arr[i];
			if(s<=x)
			c++;
			else break;
		}
		int cnt=0;
		System.out.println(c);
		for(int i=0;i<arr.length;i++)
		{
			if(cnt==c)
			{
				System.exit(0);
			}
			for(int j=0;j<arr.length;j++)
			{
				if(second[j]==arr[i])
				{
					System.out.print((j+1)+" ");
					cnt++;
					second[j]=(int)-1e9;
					break;
				}
			}
		}
//		out.close();
	}
}
class fastscanner
{
	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	String next() throws IOException
	{
		return br.readLine();
	}
	int nextInt() throws NumberFormatException, IOException
	{
		return Integer.parseInt(br.readLine());
	}
	long nextLong() throws NumberFormatException, IOException
	{
		return Long.parseLong(br.readLine());
	}
	double nextDouble() throws NumberFormatException, IOException
	{
		return Double.parseDouble(br.readLine());
	}
	int[] sort(int arr[])
	{
		ArrayList<Integer> list = new ArrayList<Integer>();
		for(int i:arr)list.add(i);
		Collections.sort(list);
		for(int i=0;i<arr.length;i++)
		{
			arr[i]=list.get(i);
		}
		return arr;
	}
	int[] readArray(int arr[]) throws IOException
	{
		String pass[]=br.readLine().split(" ");
		for(int i=0;i<pass.length;i++)
		{
		   arr[i]=Integer.parseInt(pass[i]);
		}
		return arr;
	}
	long[] longreadArray(long arr[]) throws IOException
	{
		String pass[]=br.readLine().split(" ");
		for(int i=0;i<pass.length;i++)
		{
		   arr[i]=Long.parseLong(pass[i]);
		}
		return arr;
	}
}

/**
 * Created by Admin on 1/23/2015.
 */
import java.io.*;
import java.util.ArrayList;
import java.util.Collections;
import java.util.StringTokenizer;

public class CF_287_A {
    static class Reader {
        BufferedReader boiler;
        StringTokenizer plate;

        void init(InputStream input) {
            boiler = new BufferedReader(new InputStreamReader(input));
            plate = new StringTokenizer("");
        }

        String next() throws IOException {
            while (!plate.hasMoreTokens()) {
                plate = new StringTokenizer(boiler.readLine());
            }
            return plate.nextToken();
        }

        int nextInt() throws IOException {
            return Integer.parseInt(next());
        }
    }
    private static class Pair implements Comparable<Pair>{
        int a, b;
        public Pair(int a, int b){
            this.a = a;
            this.b = b;
        }
        public int compareTo(Pair o){
            if(this.a == o.a){
                return this.b - o.b;
            }
            return this.a - o.a;
        }
    }
    public static void main(String[] args) throws IOException{
        Reader sc = new Reader();
        sc.init(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        ArrayList<Pair> nums= new ArrayList<Pair>();
        for(int i = 0; i < n; i++){
            nums.add(new Pair(sc.nextInt(), i+1));
        }
        Collections.sort(nums);
        int ans = 0;
        StringBuilder output = new StringBuilder("");
        for(int i = 0; i  < n; i++){
            if(k >= nums.get(i).a){
                k-=nums.get(i).a;
                ans++;
                output.append(nums.get(i).b + " ");
            }
        }
        System.out.println(ans);
        if(ans > 0) {
            System.out.println(output.toString().substring(0, output.length()-1));
        }
    }
}

import java.awt.List;
import java.math.BigInteger;
import java.math.MathContext;
import java.sql.Time;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Locale;
import java.util.Scanner;

import javax.swing.DefaultListModel;

public class MainTest
{
    static void print(int a[])
    {
        for(int i=0;i<a.length;i++) System.out.print(a[i]+" ");
        System.out.println();
    }
    static void print(int a[][])
    {
        for(int i=0; i<a.length;i++) print(a[i]);
    }
    static void print(long a[])
    {
        for(int i=0;i<a.length;i++) System.out.print(a[i]+" ");
        System.out.println();
    }
    static void println(int a[])
    {
        for(int i=0;i<a.length;i++) System.out.println(a[i]+" ");
    }

    static int sum(int []a)
    {
        int res=0;
        for(int i=0;i<a.length;i++) res+=a[i];
        return res;
    }
    static long[] getSimple(int from,int to)
    {
        long a[]=new long[to-from];
        for(int i=0;i<a.length;i++) a[i]=from+i;
        //print(a);
        int sum=0;
        for(int i=0;i<a.length;i++)
        {
            if(a[i]>0)
            {
                for(int j=i+1;j<a.length;j++) if(a[j]%a[i]==0) a[j]=0;
                sum++;
            }
        }
        long b[]=new long[sum];
        sum=0;
        for(int i=0;i<a.length;i++) if(a[i]>0) {b[sum]=a[i]; sum++;}
        //System.out.println("SIMPLE!");
        print(b);
        return b;
    }
    static int check(int a)
    {
        if(a==1) return 0;
        else return 1;
    }
    static int[] inverse(int []a, int x,int y)
    {
        int b[]=new int[a.length];
        for(int i=0;i<a.length;i++)
        {
            if(i>=x&&i<=y)
            {
                if(a[i]==1) b[i]=0;
                else b[i]=1;
                continue;
            }
            b[i]=a[i];
        }
        return b;
    }
    static long sum(long a)
    {
        long res=0;
        for(int i=1;i<=a;i++) res+=i;
        return res;
    }
    static void charToInt()
    {
        for(int i=0;i<256;i++) System.out.println(i+":"+(char)i);
    }
    //static int a[];
    public static void main(String args[])
    {
        Scanner in=new Scanner(System.in);
        int n=in.nextInt();
        int k=in.nextInt();
        int a[]=new int[n];
        for(int i=0;i<n;i++) a[i]=in.nextInt();
        int resValue=0;
        String res="";
        while(true)
        {
            int min=101;
            int imin=0;
            for(int i=0;i<n;i++)
                if(a[i]<min&&a[i]!=0) {min=a[i]; imin=i;}
            if(k<min||min==101) break;
            k-=min;
            a[imin]=0;
            res+=(imin+1)+" ";
            resValue++;
        }
        System.out.println(resValue);
        if(resValue!=0) System.out.println(res.trim());
    }

}

import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.StringTokenizer;

public class AmrAndMusic {
	public static void main(String[] args) {
		out = new PrintWriter(new BufferedOutputStream(System.out));
		Reader in = new Reader();
		int n = in.readInt(), k = in.readInt();
		int[] a = in.readIntArray(n);
		int[] b = Arrays.copyOf(a, n);
		Arrays.sort(a);
		List<Integer> list = new ArrayList<>();
		for(int i = 0; i < n; i++){
			if(k - a[i] >= 0){
				list.add(a[i]);
				k -= a[i];
			}else break;
		}
		out.println(list.size());
		if(list.size() > 0){
			int count = 0;
			for(int num : list){
				for(int i = 0; i < n; i++){
					if(num == b[i] && count < list.size()) {
						out.print(i + 1 + " ");
						b[i] = Integer.MIN_VALUE;
						count++;
					}
				}
			}
		}
		in.close();
		out.close();
	}
	static PrintWriter out;
	static class Reader {
		BufferedReader br;
		StringTokenizer st;
		public Reader() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}
		String read() {
			while (st == null || !st.hasMoreElements()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}
		int readInt() {
			return Integer.parseInt(read());
		}
		long readLong() {
			return Long.parseLong(read());
		}
		double readDouble() {
			return Double.parseDouble(read());
		}
		char readChar() {
			return read().charAt(0);
		}
		int[] readIntArray(int n) {
			int[] a = new int[n];
			for (int i = 0; i < n; i++)
				a[i] = readInt();
			return a;
		}
		long[] readLongArray(int n) {
			long[] a = new long[n];
			for (int i = 0; i < n; i++)
				a[i] = readLong();
			return a;
		}
		double[] readDoubleArray(int n) {
			double[] a = new double[n];
			for (int i = 0; i < n; i++)
				a[i] = readDouble();
			return a;
		}
		String[] readStringArray(int n) {
			String[] s = new String[n];
			for (int i = 0; i < n; i++)
				s[i] = read();
			return s;
		}
		char[] readCharArray(int n) {
			char[] ch = new char[n];
			for (int i = 0; i < n; i++)
				ch[i] = readChar();
			return ch;
		}
		String readLine() {
			String str = "";
			try {
				str = br.readLine();
			} catch (IOException e) {
				e.printStackTrace();
			}
			return str;
		}
		void close() {
			try {
				br.close();
			} catch (IOException e) {
				e.printStackTrace();
			}
		}
	}
}

import java.io.InputStream;
import java.io.PrintStream;
import java.util.Arrays;
import java.util.Comparator;
import java.util.Scanner;

public class CFS507A {

	public final static String IN_FILE = "test/CFS507A.in";
	public final static String OUT_FILE = "test/CFS507A.out";

	public static void main(String[] args) throws Exception {
		// InputStream in = new FileInputStream(IN_FILE);
		//
		// @SuppressWarnings("resource")
		// PrintStream out = new PrintStream(OUT_FILE);

		InputStream in = System.in;
		PrintStream out = System.out;

		Scanner IN = new Scanner(in);

		int n = IN.nextInt();
		int k = IN.nextInt();

		final int[] A = new int[n];
		for (int i = 0; i < n; i++) {
			A[i] = IN.nextInt();
		}

		IN.close();

		Integer[] B = new Integer[n];
		int[] G = new int[n];
		for (int i = 0; i < n; i++) {
			B[i] = i;
			G[i] = 0;
		}
		Arrays.sort(B, new Comparator<Integer>() {
			@Override
			public int compare(Integer o1, Integer o2) {
				return A[o1] - A[o2];
			}
		});

		int mG = 0;
		int tG = 0;
		for (int i = 0; i < n; i++) {
			if (tG + A[B[i]] <= k) {
				G[mG] = B[i];
				tG += A[B[i]];
				mG++;
			}
		}

		out.println(mG);

		for (int i = 0; i < mG; i++) {
			out.print((i == 0 ? "" : " ") + (G[i] + 1));
		}
		out.println();
	}
}

import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Comparator;
import java.util.Scanner;

/**
 * @author pvasilyev
 * @since 23 Jan 2015
 */
public class A {

    public static void main(String[] args) {
        final Scanner reader = new Scanner(System.in);
        final PrintWriter writer = new PrintWriter(System.out);

        solve(reader, writer);

        reader.close();
        writer.close();
    }

    private static void solve(final Scanner reader, final PrintWriter writer) {
        final int n = reader.nextInt();
        final int k = reader.nextInt();
        Instrument[] a = new Instrument[n];
        for (int i = 0; i < a.length; i++) {
            a[i] = new Instrument(reader.nextInt(), i);
        }
        Arrays.sort(a, new Comparator<Instrument>() {
            @Override
            public int compare(final Instrument o1, final Instrument o2) {
                final int compare = Integer.compare(o1.days, o2.days);
                return compare != 0 ? compare : Integer.compare(o1.index, o2.index);
            }
        });
        int sum = 0;
        int index = -1;
        for (int i = 0; i < n; ++i) {
            if (sum + a[i].days <= k) {
                sum += a[i].days;
                index = i;
            } else {
                break;
            }
        }
        if (index == -1) {
            writer.println(0);
            return;
        } else {
            writer.println(index + 1);
        }
        for (int i = 0; i <= index; ++i) {
            writer.print((a[i].index+1) + " ");
        }

    }

    private static final class Instrument {
        int days;
        int index;

        public Instrument(final int days, final int index) {
            this.days = days;
            this.index = index;
        }
    }

}

import java.lang.*;
import java.io.*;
import java.util.*;
public class Solution
{
		public static void main(String args[]){
	    Scanner in = new Scanner(System.in);
        int n=in.nextInt();
        int  k=in.nextInt();
        int sum=0;
        int[] a=new int[n];
        int[] as=new int[n+5];
        for(int i=0;i<n;i++){
        	a[i]=in.nextInt();
        	as[i]=a[i];
        }
		Arrays.sort(a);
		int temp=0;
		int j=0;
		while(j<n){
			temp=temp+a[j];
			j++;
			if(k>=temp)
			{
				sum++;
			}
		}
		System.out.println(sum);
		for(int i=0;i<sum;i++){
			//int temp=a[i];
			for(int l=0;l<n;l++){
				if(a[i]==as[l]){
			System.out.print((l+1)+" ");as[l]=-1;l++;break;}
		}}

		}}

import java.util.Scanner;

//import java.util.Arrays;

public class A507 {

	@SuppressWarnings("resource")
	public static void main(String[] args) {

		Scanner input = new Scanner(System.in);
		int n = input.nextInt();
		int days = input.nextInt();

		int[] instruments = new int[n];
		int min = 99999999;
		int learned = 0;

		int[] answer = new int[n];
		int i, index = 0;

		for (i = 0; i < n; i++) {
			instruments[i] = input.nextInt();
		}

		while (days > 0) {
			for (i = 0; i < instruments.length; i++) {
				if (instruments[i] < min) {
					min = instruments[i];
					index = i;
				}
			}
			instruments[index] = 999999999;
			if (days - min >= 0) {
				days -= min;
				answer[learned] = index;
				learned++;
				min = 9999999;
			} else {
				break;
			}
		}

		System.out.println(learned);
		for (i = 0; i < learned; i++) {
			System.out.print((answer[i] + 1) + " ");
		}
	}

}

//################################################################################################################
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.io.UnsupportedEncodingException;
import java.io.Writer;
import java.math.BigInteger;
import java.util.Arrays;
import java.util.InputMismatchException;

//################################################################################################################
public class R287D2A {
	public static void main(String[] args) {
		R287D2A a = new R287D2A();
		InputReader1 reader = a.new InputReader1(System.in);
		OutputWriter writer = a.new OutputWriter(System.out);
		// think about the brute-force approach
		// read input
		// code boundary conditions
		int n = reader.readInt();
		int k = reader.readInt();
		Pair[] pairs = new Pair[n];
		for (int i = 0; i < pairs.length; i++) {
			int tmp = reader.readInt();
			pairs[i] = a.new Pair(tmp, i);
		}
		Arrays.sort(pairs);
		int count = 0;
		int sum = 0;
		StringBuilder tmp = new StringBuilder();
		for (int i = 0; i < pairs.length; i++) {
			if (sum + pairs[i].v <= k) {
				count++;
				sum += pairs[i].v;
				tmp.append(pairs[i].i + 1);
				tmp.append(" ");
			} else {
				break;
			}
		}
		if (k == 0) {
			writer.println(0);
		} else {
			if (tmp.length() > 0) {
				tmp.deleteCharAt(tmp.length() - 1);
			}
			writer.println(count);
			writer.println(tmp.toString());
		}
		reader.close();
		writer.close();
	}

	class Pair implements Comparable<Pair> {
		int v;
		int i;

		public Pair(int v, int i) {
			this.v = v;
			this.i = i;
		}

		@Override
		public int compareTo(Pair arg0) {
			return this.v - arg0.v;
		}
	}

	class InputReader1 {
		// private final boolean finished = false;

		private InputStream stream;
		private byte[] buf = new byte[1024];
		private int curChar;
		private int numChars;

		public InputReader1(InputStream stream) {
			this.stream = stream;
		}

		public int read() {
			if (numChars == -1)
				throw new InputMismatchException();
			if (curChar >= numChars) {
				curChar = 0;
				try {
					numChars = stream.read(buf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (numChars <= 0)
					return -1;
			}
			return buf[curChar++];
		}

		public int peek() {
			if (numChars == -1)
				return -1;
			if (curChar >= numChars) {
				curChar = 0;
				try {
					numChars = stream.read(buf);
				} catch (IOException e) {
					return -1;
				}
				if (numChars <= 0)
					return -1;
			}
			return buf[curChar];
		}

		public int readInt() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			int res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

		public long readLong() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			long res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

		public String readString() {
			int length = readInt();
			if (length < 0)
				return null;
			byte[] bytes = new byte[length];
			for (int i = 0; i < length; i++)
				bytes[i] = (byte) read();
			try {
				return new String(bytes, "UTF-8");
			} catch (UnsupportedEncodingException e) {
				return new String(bytes);
			}
		}

		public boolean isSpaceChar(int c) {
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}

		private String readLine0() {
			StringBuffer buf = new StringBuffer();
			int c = read();
			while (c != '\n' && c != -1) {
				if (c != '\r')
					buf.appendCodePoint(c);
				c = read();
			}
			return buf.toString();
		}

		public String readLine() {
			String s = readLine0();
			while (s.trim().length() == 0)
				s = readLine0();
			return s;
		}

		public String readLine(boolean ignoreEmptyLines) {
			if (ignoreEmptyLines)
				return readLine();
			else
				return readLine0();
		}

		public BigInteger readBigInteger() {
			try {
				return new BigInteger(readString());
			} catch (NumberFormatException e) {
				throw new InputMismatchException();
			}
		}

		public char readCharacter() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			return (char) c;
		}

		public double readDouble() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			double res = 0;
			while (!isSpaceChar(c) && c != '.') {
				if (c == 'e' || c == 'E')
					return res * Math.pow(10, readInt());
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			}
			if (c == '.') {
				c = read();
				double m = 1;
				while (!isSpaceChar(c)) {
					if (c == 'e' || c == 'E')
						return res * Math.pow(10, readInt());
					if (c < '0' || c > '9')
						throw new InputMismatchException();
					m /= 10;
					res += (c - '0') * m;
					c = read();
				}
			}
			return res * sgn;
		}

		public boolean isExhausted() {
			int value;
			while (isSpaceChar(value = peek()) && value != -1)
				read();
			return value == -1;
		}

		public String next() {
			return readString();
		}

		public boolean readBoolean() {
			return readInt() == 1;
		}

		public void close() {
			try {
				stream.close();
			} catch (IOException e) {
				e.printStackTrace();
			}
		}
	}

	class OutputWriter {
		private final PrintWriter writer;

		public OutputWriter(OutputStream stream) {
			writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(
					stream)));
		}

		public OutputWriter(Writer writer) {
			this.writer = new PrintWriter(writer);
		}

		public void println(String s) {
			writer.println(s);
		}

		public void println(int x) {
			writer.println(x);
		}

		public void print(int x) {
			writer.print(x);
		}

		public void println(long x) {
			writer.println(x);
		}

		public void printSpace() {
			writer.print(" ");
		}

		public void close() {
			writer.close();
		}
	}
}

import java.io.*;
import java.util.*;

public class a{
	private static class Inst implements Comparable<Inst>{
		int val;
		int index;

		@Override
		public int compareTo(Inst other){
			return this.val - other.val;
		}
	}

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n, k;
		n = in.nextInt();
		k = in.nextInt();
		Inst a[] = new Inst[n];
		for (int i = 0; i < n; i++){
			a[i] = new Inst();
			a[i].val = in.nextInt();
			a[i].index = i;
		}

		boolean good[] = new boolean[n];
		Arrays.fill(good, false);

		Arrays.sort(a);
		int i;
		int sum = 0;
		for (i = 0; i < n; i++){
			sum += a[i].val;
			if (sum <= k){
				good[i] = true;
			}
			else
				break;
		}
		System.out.println(i);
		for (i = 0; i < n; i++)
			if (good[i])
				System.out.printf("%d ", a[i].index + 1);
		System.out.println();
	}
}

import java.io.*;
import java.math.BigInteger;
import java.util.*;

public class Main {

    FastScanner in;
    PrintWriter out;

    class FastScanner {
        BufferedReader reader;
        StringTokenizer tokenizer;

        FastScanner() throws IOException {
            reader = new BufferedReader(new InputStreamReader(System.in));
        }

        String nextLine() throws IOException{
            return reader.readLine();
        }

        String next() throws IOException {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                String line = reader.readLine();
                if (line == null) {
                    throw new EOFException();
                }
                tokenizer = new StringTokenizer(line);
            }
            return tokenizer.nextToken();
        }

        int nextInt() throws IOException {
            return Integer.parseInt(next());
        }

        long nextLong() throws IOException{
            return Long.parseLong(next());
        }
    }

    public static void main(String[] args) throws IOException {
        new Main().run();
    }

    void run() throws IOException{
        in =new FastScanner();
        out = new PrintWriter(new OutputStreamWriter(System.out));
        solve();
        out.flush();
    }

    void solve() throws IOException {
        int n=in.nextInt(), k=in.nextInt();
        HashMap<Integer, Integer>map=new HashMap<>();
        for (int i=1; i<=n; i++) map.put(i, in.nextInt());
        List<Map.Entry<Integer, Integer>> list=new ArrayList<>(map.entrySet());
        Collections.sort(list, (o1, o2) -> o1.getValue().compareTo(o2.getValue()));
        int i=0;
        while (k>0&&i<n){
            k-=list.get(i).getValue();
            if (k>=0) i++;
        }
        out.println(i);
        for (int j=0; j<i; j++)
            out.print(list.get(j).getKey()+" ");
    }

}

import java.io.*;    //PrintWriter
import java.math.*;  //BigInteger, BigDecimal
import java.util.*;  //StringTokenizer, ArrayList

public class R287_Div2_A
{
	FastReader in;
	PrintWriter out;

	public static void main(String[] args)  {
		new R287_Div2_A().run();
	}

	void run()
	{
		in = new FastReader(System.in);
		out = new PrintWriter(System.out);
		solve();
		out.close();
	}

	class Pair {
		int a,b;
		public Pair(int a, int b)
		{
			this.a = a;
			this.b = b;
		}
	}

	void solve()
	{
		int n = in.nextInt();
		int k = in.nextInt();

		int a, b;
		Pair[] p = new Pair[n];
		for (int i = 0; i < n; i++)
		{
			a = in.nextInt();
			b = i+1;
			p[i] = new Pair(a,b);
		}

		Arrays.sort(p, (o1, o2) -> o1.a - o2.a);

		int sum = 0, cnt = 0;
		String s = "";
		for (int i = 0; i < n; i++)
			if (sum + p[i].a <= k)
			{
				cnt++;
				s += p[i].b + " ";
				sum += p[i].a;
			}
			else
				break;

		out.println(cnt);
		if (cnt > 0) out.println(s);
	}

	//-----------------------------------------------------
	void runWithFiles() {
		in = new FastReader(new File("input.txt"));
		try {
			out = new PrintWriter(new File("output.txt"));
		}
		catch (FileNotFoundException e) {
			e.printStackTrace();
		}
		solve();
		out.close();
	}

	class FastReader
	{
	    BufferedReader br;
	    StringTokenizer tokenizer;

	    public FastReader(InputStream stream)
	    {
	        br = new BufferedReader(new InputStreamReader(stream));
	        tokenizer = null;
	    }
		public FastReader(File f) {
			try {
				br = new BufferedReader(new FileReader(f));
				tokenizer = null;
			}
			catch (FileNotFoundException e) {
				e.printStackTrace();
			}
		}

	    private String next() {
	        while (tokenizer == null || !tokenizer.hasMoreTokens())
	            try {
	            	tokenizer = new StringTokenizer(br.readLine());
	            }
	            catch (IOException e) {
	                throw new RuntimeException(e);
	            }
	        return tokenizer.nextToken();
	    }
		public String nextLine() {
			try	{
				return br.readLine();
			}
			catch(Exception e) {
				throw(new RuntimeException());
			}
		}

	    int nextInt() {
	        return Integer.parseInt(next());
	    }
	    long nextLong() {
	        return Long.parseLong(next());
	    }
	    double nextDouble() {
	        return Double.parseDouble(next());
	    }
	    BigInteger nextBigInteger() {
	        return new BigInteger(next());
	    }
	    BigDecimal nextBigDecimal() {
	        return new BigDecimal(next());
	    }
	}
}

import java.io.*;
import java.util.*;

public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String q[] = br.readLine().split(" ");
		int n = Integer.parseInt(q[0]);
		int k = Integer.parseInt(q[1]);
		 q = br.readLine().split(" ");
		int a[] = new int[n];
		for(int i=0;i<n;i++ ) a[i] = Integer.parseInt(q[i]);

		int ans[] = new int[n+1];int index = 0;
		while(k>0){
			int min = 101;int j = 0;
			for(int i=0;i<n;i++){
				if(a[i]<min){
					min=a[i];
					j=i;
				}
			}
			if(min<=k && min<101){
				k=k-min;
				a[j] = Integer.MAX_VALUE;
				ans[index] = j+1;
				index++;
			}else{
				break;
			}
		}
		System.out.println(index);
		for(int i=0;i<index;i++) System.out.print(ans[i]+" ");
		System.out.println();
		// end of main
	}

}

//package A;
import java.io.*;
import java.util.*;
public class amr_and_music
{
	public static void main(String[] args) throws NumberFormatException, IOException
	{
		PrintWriter out=new PrintWriter(System.out);
		fastscanner fs=new fastscanner();
		int input[]=new int[2];
		fs.readArray(input);
		int n=input[0],c=0,sum=0;
		int x=input[1],index=0;
		int arr[]=new int[n];
		int second[]=new int[n];
		fs.readArray(arr);
		for(int i:arr)
		{
			second[index]=i;
			index++;
		}
		fs.sort(arr);
		for(int i=0;i<n;i++)
		{
			sum=sum+arr[i];
			if(sum<=x)
			c++;
			else break;
		}
		int cnt=0;
		System.out.println(c);
		for(int i=0;i<arr.length;i++)
		{
			if(cnt==c)
			{
				System.exit(0);
			}
			for(int j=0;j<arr.length;j++)
			{
				if(second[j]==arr[i])
				{
					System.out.print((j+1)+" ");
					cnt++;
					second[j]=(int)-1e9;
					break;
				}
			}
		}
//		out.close();
	}
}
class fastscanner
{
	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	String next() throws IOException
	{
		return br.readLine();
	}
	int nextInt() throws NumberFormatException, IOException
	{
		return Integer.parseInt(br.readLine());
	}
	long nextLong() throws NumberFormatException, IOException
	{
		return Long.parseLong(br.readLine());
	}
	double nextDouble() throws NumberFormatException, IOException
	{
		return Double.parseDouble(br.readLine());
	}
	int[] sort(int arr[])
	{
		ArrayList<Integer> list = new ArrayList<Integer>();
		for(int i:arr)list.add(i);
		Collections.sort(list);
		for(int i=0;i<arr.length;i++)
		{
			arr[i]=list.get(i);
		}
		return arr;
	}
	int[] readArray(int arr[]) throws IOException
	{
		String pass[]=br.readLine().split(" ");
		for(int i=0;i<pass.length;i++)
		{
		   arr[i]=Integer.parseInt(pass[i]);
		}
		return arr;
	}
	long[] longreadArray(long arr[]) throws IOException
	{
		String pass[]=br.readLine().split(" ");
		for(int i=0;i<pass.length;i++)
		{
		   arr[i]=Long.parseLong(pass[i]);
		}
		return arr;
	}
}

import java.io.*;
import java.util.*;

public class Amr2{
static class Pair implements Comparable<Pair>{
int first,second;
public Pair(int first,int second){

this.first=first;
this.second=second;

}
@Override
public String toString(){
return "(" + first +"," +second +")";

}
public boolean equals(Object o)
{
if(this==o)return true;
if(o==null || o.getClass() !=getClass()) return false;
Pair p=(Pair)o;
return first==p.first && second==p.second;

}
public int hashCode()
{
int result=1;
result=31*result+first;
result = 31* result+second;
return result;

}

public int compareTo(Pair o){

if(first < o.first) return -1;
if(first > o.first) return 1;
return 0;

}

}
public static void main(String[] args) throws IOException{
BufferedReader r=new BufferedReader(new InputStreamReader(System.in));
String[] nm=(r.readLine()).split(" ");
int n=Integer.parseInt(nm[0]);
int m=Integer.parseInt(nm[1]);
String[] val=(r.readLine()).split(" ");
ArrayList<Pair> al=new ArrayList<Pair>();
for(int i=0;i<n;i++)
{
al.add(new Pair(Integer.parseInt(val[i]),i+1));
}
Collections.sort(al);
//for(int i=0;i<n;i++)
//System.out.println(al);
int days=0,x=0;
ArrayList<Integer> ans=new ArrayList<>();
for(int i=0;i<n;++i)
{
if(days + al.get(i).first <= m)
{
days += al.get(i).first;++x;
ans.add(al.get(i).second);
}
}

System.out.println(x);
for(int i=0;i<x;++i)
{
System.out.print(ans.get(i)+" ");

}

}
}

import java.util.Arrays;
import java.util.Scanner;

public class A {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int k = sc.nextInt();
		int a[] = new int[n];
		for (int i = 0; i < n; i++) {
			a[i] = sc.nextInt();
		}
		boolean flag[] = new boolean[n];
		for (int i = 0; i < n; i++) {
			flag[i] = false;
		}
		int[] b = a.clone();
		Arrays.sort(b);
		long day = 0;
		int count = 0;
		StringBuffer sb = new StringBuffer();
		for (int i = 0; i < n; i++) {
			int tmp = b[i];
			if (day + tmp <= k) {
				count++;
				day += tmp;
				for (int j = 0; j < n; j++) {
					if (a[j] == tmp && flag[j]==false) {
						sb.append(j + 1 + " ");
						a[j] = 101;
						flag[j] =true;
						break;
					}
				}
			} else {
				break;
			}
		}
		System.out.println(count);
		System.out.print(sb);
	}
}

import java.util.Scanner;

public class A2 {
    public static void main(String args[]){
        Scanner scan = new Scanner(System.in);
        int n,k;
        n = scan.nextInt();
        k = scan.nextInt();
        int mass[] = new int[n];
        int massive[] = new int[n];
        for(int i = 0;i<n;i++){
            mass[i]=scan.nextInt();
            massive[i]=mass[i];
        }

        int mass2[] = new int[n];
        sort(mass,n);
        int i=0;
        int sum=0;
        while(sum<k){
            sum+=mass[i];
            if(k<sum){sum-=mass[i];break;}
            i++;if(i>=mass.length)break;

        }
        System.out.println(i);
        for(int j=0;j<i;j++){
            for(int h=0;h<n;h++){
                if(mass[j]==massive[h]){System.out.print(h+1+" ");massive[h]=0;break;}
            }
        }
    }
    public static int[] sort(int mass[], int n){
        int cont;
    for(int j=0;j<n;j++){
        for(int i=0;i<n-1;i++){
            if  (mass[i]>mass[i+1]){
                cont = mass[i];
                mass[i]=mass[i+1];
                mass[i+1]=cont;
                }
        }
    }
        return mass;
    }

}

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;

public class B {

	static StringBuilder out = new StringBuilder();
	static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	static StringTokenizer st;
	static int n,d;
	static int arr[];
	static int map[];
	static int dp[][] = new int[100+1][100001];

	public static void main(String[]args)throws Throwable{
		st = new StringTokenizer(br.readLine());
		n  = Integer.parseInt(st.nextToken());
		d = Integer.parseInt(st.nextToken());
		map = new int[n];
		arr = new int[n];
		int c = 0;
		for(int i=0;i<101;i++) for(int k=0;k<100001;k++) dp[i][k] = -1;
		st = new StringTokenizer(br.readLine());
		for(int i=0;i<n;i++) arr[i] = Integer.parseInt(st.nextToken());
		out.append(solve(0,d)+"\n");

		trace(0,d);
		System.out.print(out);
	}

	static int solve(int i, int k){

		if(k<0) return -2000000000;
		if(i==n) return 0;
		if(dp[i][k]!=-1) return dp[i][k];
		return dp[i][k] = Math.max((1+solve(i+1,k-arr[i])),solve(i+1,k));
	}

	static void trace(int i, int k){

		if(k<0) return;
		if(i==n) return;

		 if(dp[i][k] == 1+solve(i+1,k-arr[i])){
			 out.append((i+1)+" ");
			 trace(i+1,k-arr[i]);
			 return;
		 }
		 else trace(i+1,k);
	}
}

import java.util.*;

public class A507 {

	public static class Pair implements Comparable<Pair>{
		int ind;
		int days;

		public Pair(int i, int d) {
			this.ind = i;
			this.days = d;
		}

		@Override
		public int compareTo(Pair o) {
			if (this.days > o.days) {
				return 1;
			}
			else if (this.days < o.days) {
				return -1;
			}
			return 0;
		}
	}
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);

		int n = scan.nextInt();
		int k = scan.nextInt();

		List<Pair> list = new ArrayList();

		for (int i = 1; i <= n; i++) {
			list.add(new Pair(i, scan.nextInt()));
		}

		Collections.sort(list);

		String ans = "";

		int sum = 0;
		int s = 0;
		for (int i = 0; i < n; i++) {
			sum += list.get(i).days;
			if (sum > k) {
				break;
			}
			s = i+1;
			ans += list.get(i).ind + " ";
		}
		ans = s + "\n" + ans;
		System.out.println(ans);
	}

}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;

public class A {
	public static void main(String[] args) throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer strTok = new StringTokenizer(br.readLine());
		int n = Integer.parseInt(strTok.nextToken());
		int k = Integer.parseInt(strTok.nextToken());
		node a[] = new node[n];
		strTok = new StringTokenizer(br.readLine());
		for(int i=0;i<n;i++){
			int aa =  Integer.parseInt(strTok.nextToken());
			a[i] = new node(i+1, aa);
		}
		Arrays.sort(a);
		int m = 0;
		int idx = 0;
		while(k>0){
			if(idx>=n) break;
			if(a[idx].val>k) break;

			k -= a[idx++].val;
			m++;
		}
		System.out.println(m);
		int i=0;
		for(;i<idx-1;i++){
			System.out.print(a[i].num+" ");
		}
		if(m!=0)System.out.println(a[i].num+" ");
	}
}
class node implements Comparable<node>{
	int num;
	int val;
	public node(int i, int v){
		num = i;
		val = v;
	}
	@Override
	public int compareTo(node o) {
		return (this.val-o.val);
	}

}

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	MyScanner sc = new MyScanner();
	Scanner sc2 = new Scanner(System.in);
	final int MOD = 1000000007;
	int[] dx = { 1, 0, 0, -1 };
	int[] dy = { 0, 1, -1, 0 };

	void run() {
		int n = sc.nextInt();
		int k = sc.nextInt();
		Info[] a = new Info[n];
		for (int i = 0; i < n; i++) {
			a[i] = new Info(i + 1, sc.nextInt());
		}
		Arrays.sort(a);
		ArrayList<Integer> list = new ArrayList<Integer>();
		for (int i = 0; i < n; i++) {
			if (a[i].cost <= k) {
				list.add(a[i].num);
				k -= a[i].cost;
			}
		}
		System.out.println(list.size());
		for (int i = 0; i < list.size(); i++) {
			System.out.print((i == 0 ? "" : " ") + list.get(i));
		}
		System.out.println();
	}

	class Info implements Comparable<Info> {
		int num;
		int cost;

		/**
		 * @param num
		 * @param cost
		 */
		public Info(int num, int cost) {
			super();
			this.num = num;
			this.cost = cost;
		}

		@Override
		public int compareTo(Info arg0) {
			return this.cost - arg0.cost;
		}
	}

	public static void main(String[] args) {
		new Main().run();
	}

	void debug(Object... o) {
		System.out.println(Arrays.deepToString(o));
	}

	void debug2(int[][] array) {
		for (int i = 0; i < array.length; i++) {
			for (int j = 0; j < array[i].length; j++) {
				System.out.print(array[i][j]);
			}
			System.out.println();
		}
	}

	boolean inner(int h, int w, int limH, int limW) {
		return 0 <= h && h < limH && 0 <= w && w < limW;
	}

	void swap(int[] x, int a, int b) {
		int tmp = x[a];
		x[a] = x[b];
		x[b] = tmp;
	}

	// find minimum i (a[i] >= border)
	int lower_bound(int a[], int border) {
		int l = -1;
		int r = a.length;

		while (r - l > 1) {
			int mid = (l + r) / 2;
			if (border <= a[mid]) {
				r = mid;
			} else {
				l = mid;
			}
		}
		// r = l + 1
		return r;
	}

	boolean palindrome(String s) {
		for (int i = 0; i < s.length() / 2; i++) {
			if (s.charAt(i) != s.charAt(s.length() - 1 - i)) {
				return false;
			}
		}
		return true;
	}

	class MyScanner {
		int nextInt() {
			try {
				int c = System.in.read();
				while (c != '-' && (c < '0' || '9' < c))
					c = System.in.read();
				if (c == '-')
					return -nextInt();
				int res = 0;
				do {
					res *= 10;
					res += c - '0';
					c = System.in.read();
				} while ('0' <= c && c <= '9');
				return res;
			} catch (Exception e) {
				return -1;
			}
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}

		long nextLong() {
			return Long.parseLong(next());
		}

		String next() {
			try {
				StringBuilder res = new StringBuilder("");
				int c = System.in.read();
				while (Character.isWhitespace(c))
					c = System.in.read();
				do {
					res.append((char) c);
				} while (!Character.isWhitespace(c = System.in.read()));
				return res.toString();
			} catch (Exception e) {
				return null;
			}
		}

		int[] nextIntArray(int n) {
			int[] in = new int[n];
			for (int i = 0; i < n; i++) {
				in[i] = nextInt();
			}
			return in;
		}

		int[][] nextInt2dArray(int n, int m) {
			int[][] in = new int[n][m];
			for (int i = 0; i < n; i++) {
				in[i] = nextIntArray(m);
			}
			return in;
		}

		double[] nextDoubleArray(int n) {
			double[] in = new double[n];
			for (int i = 0; i < n; i++) {
				in[i] = nextDouble();
			}
			return in;
		}

		long[] nextLongArray(int n) {
			long[] in = new long[n];
			for (int i = 0; i < n; i++) {
				in[i] = nextLong();
			}
			return in;
		}

		char[][] nextCharField(int n, int m) {
			char[][] in = new char[n][m];
			for (int i = 0; i < n; i++) {
				String s = sc.next();
				for (int j = 0; j < m; j++) {
					in[i][j] = s.charAt(j);
				}
			}
			return in;
		}
	}
}

import java.util.*;
import java.io.*;
import java.math.*;

public class test {

static class InputReader {
    public BufferedReader reader;
    public StringTokenizer tokenizer;

    public InputReader(InputStream stream) {
        reader = new BufferedReader(new InputStreamReader(stream), 32768);
        tokenizer = null;
    }

    public String next() {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(reader.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken();
    }

    public int nextInt() {
        return Integer.parseInt(next());
    }

    public long nextLong() {
	return Long.parseLong(next());
    }

}

static class Pair implements Comparable<Pair> {

	public int x,y;

	public Pair(int x,int y) {
		this.x  = x;
		this.y = y;
	}

	@Override
	public int compareTo(Pair obj) {

		if(x<obj.x) return -1;
		if(x>obj.x) return 1;
		return 0;
	}

}

 static class Task {

	public void solve(int testNumber, InputReader in, PrintWriter out) {
  		while(testNumber-->0) {
			int n = in.nextInt();
			int k = in.nextInt();
			ArrayList<Pair> list = new ArrayList<Pair>();
			for(int i=0;i<n;++i)
				list.add(new Pair(in.nextInt(),i+1));

			Collections.sort(list);
			int ans = 0;
			ArrayList<Integer> idx = new ArrayList();
			int days=0;
			int sz=0;
			for(int i=0;i<n;++i)
				if(days+list.get(i).x<=k) {
					idx.add(list.get(i).y); ++sz;
					days += list.get(i).x;
				}

			out.println(sz);
			for(int i=0;i<sz;++i)
				out.print(idx.get(i)+" ");
			out.println();
    		}
	}

}

    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Task solver = new Task();
        int test  = 1;
        solver.solve(test, in, out);
        out.close();
    }

}

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Locale;
import java.util.StringTokenizer;
public class Shablon {
	static StringTokenizer st;
	static BufferedReader br;
	static PrintWriter pw;
	static class sort implements Comparable<sort> {
		int a, b;

		public sort(int a, int b) {
			this.a = a;
			this.b = b;
		}

		public int compareTo(sort arg0) {
			return (this.a - arg0.a);
		}
	}
	public static void main(String[] args) throws IOException {
		Locale.setDefault(Locale.US);
		br = new BufferedReader(new InputStreamReader(System.in));
		pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(
				System.out)));
		int n = nextInt();
		int k = nextInt();
		sort[]a = new sort[n+1];
		int cnt=0;
		for (int i = 1; i <= n; i++) {
			a[i] = new sort(nextInt(),i);
		}
		Arrays.sort(a,1,n+1);
		int x[] = new int[n+1];
		int s = 0;
		for (int i = 1; i <= n; i++) {
			if(s+a[i].a<=k){
				x[++cnt] = a[i].b;
				s+=a[i].a;
			}
		}
		System.out.println(cnt);
		for (int i = 1; i <= cnt; i++) {
			pw.print(x[i]+" ");
		}
		pw.close();
	}

	private static void gfile() throws IOException {
		br = new BufferedReader(new FileReader(new File("input.txt")));
		pw = new PrintWriter(new BufferedWriter(new FileWriter(new File(
				"output.txt"))));
	}

	private static int nextInt() throws IOException {
		return Integer.parseInt(next());
	}

	private static long nextLong() throws IOException {
		return Long.parseLong(next());
	}

	private static double nextDouble() throws IOException {
		return Double.parseDouble(next());
	}

	private static String next() throws IOException {
		while (st == null || !st.hasMoreTokens())
			st = new StringTokenizer(br.readLine());
		return st.nextToken();
	}
}

import java.io.BufferedReader;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.StringTokenizer;

public class A43 {
    public static void main(String [] args) {
        InputStream inputReader = System.in;
        OutputStream outputReader = System.out;
        InputReader in = new InputReader(inputReader);
        PrintWriter out = new PrintWriter(outputReader);
        Algorithm solver = new Algorithm();
        solver.solve(in, out);
        out.close();
    }
}

class Algorithm {
    void solve(InputReader ir, PrintWriter pw) {
        int n = ir.nextInt();
        int k = ir.nextInt();
        int [] a = new int[n];
        int [] b = new int[n];

        for (int i = 0; i < n; i++) {
            a[i] = ir.nextInt();
            b[i] = a[i];
        }
        sort(a, 0, n - 1);

        int ans = 0, next = 0, index = 0;
        for (int i = 0; i < n; ++i) {
            next += a[i];
            if (next > k) break;
            ans++;index = i;
        }
        pw.println(ans);
        if (ans != 0) for(int i = 0; i <= index; ++i) {
            for (int j = 0; j < n; ++j) {
                if(a[i] == b[j]){pw.print((j + 1) + " ");b[j] = -1; break;}
            }
        }

    }
    private static void sort(int[] array, int low, int high) {

        int i = low;
        int j = high;
        int x = array[low + (high - low) / 2];

        do {
            while (array[i] < x) ++i;
            while (array[j] > x) --j;
            if (i <= j) {
                int tmp = array[i];
                array[i] = array[j];
                array[j] = tmp;
                i++;
                j--;
            }
        } while (i <= j);

        if (low < j) sort(array, low, j);
        if (i < high) sort(array, i, high);

    }
}

class InputReader {
    private BufferedReader reader;
    private StringTokenizer tokenizer;

    InputReader(InputStream stream) {
        reader = new BufferedReader(new InputStreamReader(stream), 32768);
        tokenizer = null;
    }

    String next() {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(reader.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken();
    }

    int nextInt() {
        return Integer.parseInt(next());
    }

}

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
//package Codeforces;

/**
 *
 * @author Administrator
 */
import java.util.Scanner;

public class c507A {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int k = in.nextInt();
        int[] a = new int[102];
        int[] cs = new int[102];
        for (int i = 1; i <= n; i++) {
            a[i] = in.nextInt();
            cs[i] = i;
        }
        int t;
        for (int i = 1; i < n; i++) {
            for (int j = i + 1; j <= n; j++) {
                if (a[i] > a[j]) {
                    t = a[i];
                    a[i] = a[j];
                    a[j] = t;
                    t = cs[i];
                    cs[i] = cs[j];
                    cs[j] = t;
                }
            }
        }
        int s = 0;
        int i = 0;
        while (s <= k && i <= n) {
            s += a[++i];
        }
        System.out.println(i-1);
        for (int j = 1; j <= i-1; j++) {
            System.out.print(cs[j] + " ");
        }
    }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;

public class Main
{
    static class Point implements Comparable<Point>{
        int indices;
        int value;
        public Point(int indices,int value)
        {
            this.indices=indices;
            this.value=value;
        }

        @Override
        public int compareTo(Point o) {
            return this.value-o.value;
        }
    }
    public static void main(String ab[]) throws IOException
    {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
       String line[];
        line=br.readLine().split(" ");
        int n=Integer.parseInt(line[0]);
        int k=Integer.parseInt(line[1]);
        Point point[] = new Point[n];
        line=br.readLine().split(" ");
        for (int i = 0; i < n; i++) {
            point[i]=new Point(i,Integer.parseInt(line[i]));
        }
        Arrays.sort(point);
        int count=0;
        for (int i = 0; i < n; i++) {
           if(k>=point[i].value)
           {
               k-=point[i].value;
               count++;
           }
        }
        System.out.println(count);
        for (int i = 0; i < count; i++) {
           System.out.print(point[i].indices+1+" ");
        }
    }
}

import java.util.Arrays;
import java.util.Scanner;

public class AmrAndMusic {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int instruments = in.nextInt();
        int days = in.nextInt();
        int[] learn = new int[instruments+1];
        int[] inpos = new int[instruments+1];

        for(int i=1; i<=instruments; i++) {
            learn[i] = in.nextInt();
        }
        inpos = Arrays.copyOf(learn, learn.length);

        Arrays.sort(learn);

        int j = 1;
        int count = 0;
        String result = "";
        while(days>0 && j < learn.length) {
            int got = learn[j];
            if(got <= days) {
                count++;
                days -= got;

                for(int k=1; k<inpos.length; k++) {
                    if(inpos[k] == got) {
                        result += (k + " ");
                        inpos[k] = -1;
                        break;
                    }
                }
            } else {
                break;
            }
            j++;
        }
        System.out.println(count);
        System.out.println(result.trim());

    }

}

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Scanner;

public class Amar {
	public static int search(int b[],int a)
	{
		for(int i=0;i<b.length;i++)
		{
			if(b[i]==a)
			{
				b[i] = -1;
				return i+1;
			}
		}
		return -1;
	}
  public static void main(String[] args) {
	Scanner sc = new Scanner(System.in);
	int n1 = sc.nextInt();
	int n2 = sc.nextInt();
	int a[] = new int[n1];
     int b[] = new int[n1];
	ArrayList<Integer> al = new ArrayList<>();
	for(int i=0;i<n1;i++)
	{
	b[i]=a[i] = sc.nextInt();
	}
	 Arrays.sort(a);
	 int sum=0;
	 int count=0;
	 for(int i=0;i<a.length;i++)
	 {
		 if(sum+a[i]<=n2)
		 {
		 sum = sum + a[i];
		 int a1 = search(b,a[i]);
		 count++;
		 al.add(a1);
		 }
	 }
	 Collections.sort(al);
	 System.out.println(count);
	for(Integer i : al)
	{
		System.out.print(i+" ");
	}
}
}

import java.io.*;
import java.util.*;

public class SolveContest {
    private BufferedReader in;
    private PrintWriter out;

    public SolveContest() {
        try {
            in = new BufferedReader(new FileReader("input.txt"));
            out = new PrintWriter(new FileWriter("output.txt"),true);
            solve();
        } catch (Exception e) {
            e.printStackTrace();
            in = new BufferedReader(new InputStreamReader(System.in));
            out = new PrintWriter(System.out);
            solve();
        } finally {
            try {
                in.close();
            } catch (IOException e) {

            }
            out.close();
        }
    }
    StringTokenizer st;
    String nextToken() {
        while (st == null || !st.hasMoreTokens())
            try {
                st = new StringTokenizer(in.readLine());
            } catch (IOException e) {

            }
        return st.nextToken();
    }

    int nextInt() {
        return Integer.valueOf(nextToken());
    }
    long nextLong() {
        return Long.valueOf(nextToken());
    }

    public void solve() {
        int n = nextInt();
        int k = nextInt();
        Pair[] a = new Pair[n];
        for (int i = 0; i < n; i++) {
            a[i] = new Pair(nextInt(), i);
        }
        Arrays.sort(a);
        List<Integer> list = new ArrayList<Integer>();
        for (int i = 0; i < n; i++) {
            if (a[i].a <= k) {
                list.add(a[i].b+1);
                k -= a[i].a;
            }
        }
        out.println(list.size());
        for (int i = 0; i < list.size(); i++) {
            out.print(list.get(i) + " ");
        }
    }

    public static void main(String[] args) {
        new SolveContest();
    }
}

class Pair implements Comparable<Pair>{
    int a;
    int b;
    Pair(int a_, int b_) {
        this.a = a_;
        this.b = b_;
    }

    @Override
    public int compareTo(Pair o) {
        return this.a-o.a;
    }
}

/* package codechef; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
public class Codechef
{

    static int temp1=0;
	public static void main (String[] args) throws java.lang.Exception
	{
		int n,k,i=0;
		int cnt=0;
		Scanner sc = new Scanner(System.in);
		n = sc.nextInt();
		k = sc.nextInt();
		int[] arr = new int[n];
		int[] temp = new int[n];
		int[] ind = new int[n];
		for(i=0;i<n;i++)
		{
		    arr[i] = sc.nextInt();
		    temp[i] = arr[i];
		    ind[i] = 0;
		}
		Arrays.sort(arr);
		for(i=0;i<n;i++)
		{
		    if(k-arr[i] >= 0)
		    {
		        k = k-arr[i];
		        findInd(arr[i],ind,temp);
		        cnt++;
		    }
		    else
		    {
		        break;
		    }
		}
		i=0;
		System.out.println(cnt);
		while(i != temp1)
		{
		    System.out.print(ind[i] + " ");
		    i++;
		}

	}

	public static void findInd(int num,int[] index,int[] extra)
	{
	   for(int i=0;i<extra.length;i++)
	   {
	       if(num == extra[i])
	       {
	           index[temp1] = i+1;
	           temp1++;
	           extra[i] = -1;
	           break;
	       }
	   }
	}
}

import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.Scanner;

public class D {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		TaskA solver= new TaskA();
		solver.solve(1,scan);
	}

}

class TaskA {
    class Pair {
        int first;
        int second;

        Pair(int first, int second) {
            this.first = first;
            this.second = second;
        }
    }
    public void solve(int test,Scanner scan) {
    	int n=scan.nextInt();
    	int k=scan.nextInt();
    	ArrayList<Pair> a= new ArrayList<>();
    	for(int i=0;i<n;i++) {
    		int x=scan.nextInt();
    		a.add(new Pair(x,i+1));
    	}
    	Collections.sort(a, new Comparator<Pair>() {
    		public int compare(Pair p1,Pair p2) {
    		return Integer.compare(p1.first, p2.first);
    		}
		});
    	ArrayList<Integer> res= new ArrayList<Integer>();
    	for (Pair p : a) {
			if(p.first<=k) {
				k-=p.first;
				res.add(p.second);
			}
		}
    	System.out.println(res.size());
    	Collections.sort(res);
    	for (Integer integer : res) {
			System.out.print(integer+" ");
		}
    }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;

public class A
{
    BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
    StringTokenizer st = null;

    private void solve() throws IOException
    {
        int n = nextInt();
        int k = nextInt();
        Ins a[] = new Ins[n];
        for(int i = 0; i < n; i++)
        {
            a[i] = new Ins(nextInt(), i + 1);
        }

        Arrays.sort(a);
        int counter = 0;
        for(int i = 0; i < n; i++)
        {
            if(k - a[i].days >= 0)
            {
                k -= a[i].days;
                counter++;
            }
            else
            {
                break;
            }

        }

        System.out.println(counter);
        for(int i = 0; i < counter; i++)
        {
            System.out.print(a[i].order + " ");
        }

    }

    class Ins implements Comparable<Ins>
    {
        public int days, order;
        public Ins(int days, int order)
        {
            this.days = days;
            this.order = order;
        }

        @Override
        public int compareTo(Ins o) {
            return days == o.days ? 0 : (days > o.days ? 1 : -1);
        }

    }

    String nextToken() throws IOException
    {
        if (st == null || !st.hasMoreTokens())
        {
            st = new StringTokenizer(bf.readLine());
        }

        return st.nextToken();
    }

    int nextInt() throws IOException
    {
        return Integer.parseInt(nextToken());
    }

    long nextLong() throws IOException
    {
        return Long.parseLong(nextToken());
    }

    double nextDouble() throws IOException
    {
        return Double.parseDouble(nextToken());
    }

    public static void main(String args[]) throws IOException
    {
        new A().solve();
    }

}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;

public class Main {

	static class Instrument {
		int name;
		int days;

		public Instrument (int name, int days) {
			this.name = name;
			this.days = days;
		}
	}

	public static void main(String[] args) throws IOException {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		PrintWriter out = new PrintWriter(System.out);

		String[] num = in.readLine().split(" ");
		int n = Integer.parseInt(num[0]);
		int k = Integer.parseInt(num[1]);

		num = in.readLine().split(" ");

		List<Instrument> instruments = new ArrayList<Instrument>();
		for (int i=0;i<n;i++) {
			 instruments.add(new Instrument(i+1,Integer.parseInt(num[i])));
		}

		Collections.sort(instruments, new Comparator<Instrument>() {
			public int compare(Instrument i1, Instrument i2) {
				if (i1.days>i2.days) return 1;
				if (i1.days<i2.days) return -1;
				return 0;
			}
		});

		if (k==0) out.println(0);
		else {
			int ind;
			for (ind=0; ind<n && k>0; ind++) {
				if (instruments.get(ind).days<=k) {
					k-=instruments.get(ind).days;
				} else {
					k=0;
					ind--;
					break;
				}
				if (k==0) break;
			}

				out.println(ind<instruments.size() ? ind+1 : ind);
				for (int j=0;j<=ind;j++) {
					if (j<instruments.size()) {
						out.print(instruments.get(j).name+" ");
					}
				}
			}

		out.close();
	}
}

import java.util.*;
import java.util.Scanner;
import java.io.*;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;
import java.util.StringTokenizer;

public class pc10a
{
    static class FastReader
    {
        BufferedReader br;
        StringTokenizer st;

        public FastReader()
        {
            br = new BufferedReader(new
                     InputStreamReader(System.in));
        }

        String next()
        {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException  e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt()
        {
            return Integer.parseInt(next());
        }

        long nextLong()
        {
            return Long.parseLong(next());
        }

        double nextDouble()
        {
            return Double.parseDouble(next());
        }

        String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
    }

    public static void main(String args[])
    {
        FastReader in=new FastReader();
        int n=in.nextInt();
        int k=in.nextInt();
        int arr[][]=new int[n][2];
        for(int i=0;i<n;i++)
        {
            arr[i][0]=in.nextInt();
            arr[i][1]=i;
        }
        for(int i=1;i<=n-1;i++)
        {
            for(int j=0;j<n-1;j++)
            {
                if(arr[j][0]>arr[j+1][0])
                {
                    int temp=arr[j][0];
                    arr[j][0]=arr[j+1][0];
                    arr[j+1][0]=temp;
                    int temp2=arr[j][1];
                    arr[j][1]=arr[j+1][1];
                    arr[j+1][1]=temp2;

                }
            }
        }
        int days=0;
        int count=0;
        for(int i=0;i<n;i++)
        {
            if(days+arr[i][0]<=k)
            {
                days+=arr[i][0];
                count++;

            }
            else
                break;
            if(days==k)
                break;
        }
        if(count==0)
            System.out.println(0);
        else
        {
            System.out.println(count);
            for(int i=0;i<count;i++)
            {
                    System.out.print((arr[i][1]+1)+" ");
            }
        }

        }

    }

import java.util.Arrays;
import java.util.Scanner;

public class A_Amr_and_Music_507 {

	public static void main(String[] args) {
		Scanner input = new Scanner(System.in);

		int n= input.nextInt();
		int k= input.nextInt();
		int[] a = new int[n];
		int[] as = new int[n];
		for (int i = 0; i < n; i++) {
			a[i]=input.nextInt();
			as[i]=a[i];

		}
		Arrays.sort(as);
		int sum=0;
		int count=0;
		for (int i = 0; i < as.length; i++) {
			sum=sum+as[i];
			if(sum>k){
				break;
			}
			count++;
		}
		System.out.println(count);
		for (int i = 0; i < count; i++) {
			for (int j = 0; j < a.length; j++) {
				if(as[i]==a[j]) {
					a[j]=0;
					System.out.print(j+1+" ");
					break;
				}
			}
		}

	}
}

import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        final int n = sc.nextInt();
        final int k = sc.nextInt();

        Vector2 a[] = new Vector2[n];
        Vector2 b[] = new Vector2[n];

        for (int i = 0; i < n; i++) {
            a[i]=new Vector2(sc.nextInt(),i+1);
        }

        InPlace.Sort(a);

        int t=0;
        int c=0;
      /*  for (int i = 0; i < n; i++) {

            System.out.println(a[i].getA() + " ");

        }
        System.out.println();*/

        for (int i = 0; i < n; i++) {
            t+=a[i].getA();
            if (t <= k) {

                b[c]=a[i];
                c++;
            }else {
                System.out.println(c);

                for (int j=0;j<c;j++) {
                    System.out.print(b[j].getId()+" ");
                }
                return;
            }
        }

        System.out.println(c);

        for (int j=0;j<c;j++) {
            System.out.print(b[j].getId()+" ");
        }

        // write your code here
    }
}

class InPlace {
    //static Random random = new Random();

    public static void Sort(Vector2[] array) {
        Sort(array, 0, array.length - 1);
    }

    public static void Sort(Vector2[] array, int left, int right) {
        if (right <= left)
            return;

        // random pivot
        //int pivotIndex = left + random.nextInt(right - left + 1);

        // middle pivot
        int pivotIndex = (left + right) / 2;
        Vector2 pivot = array[pivotIndex];
        Swap(array, pivotIndex, right);
        int swapIndex = left;
        for (int i = left; i < right; ++i) {
            if (array[i].getA() <= pivot.getA()) {
                Swap(array, i, swapIndex);
                ++swapIndex;
            }
        }
        Swap(array, swapIndex, right);

        Sort(array, left, swapIndex - 1);
        Sort(array, swapIndex + 1, right);
    }

    private static void Swap(Vector2[] array, int indexA, int indexB) {
        Vector2 tmp = array[indexA];
        array[indexA] = array[indexB];
        array[indexB] = tmp;
    }
}

class Vector2{
    int a;
    int id;

    Vector2(int a, int id){
        this.a=a;
        this.id=id;

    }

    public int getA() {
        return a;
    }

    public void setA(int a) {
        this.a = a;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }
}

import java.util.Arrays;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int k = scan.nextInt();
		int[] array = new int[n];
		int[] x = new int[n];
		for (int i = 0; i < n; i++) {
			array[i] = scan.nextInt();
			x[i] = array[i];
		}
		scan.close();

		Arrays.sort(x);
		int count = 0;
		int total = 0;
		for (int i = 0; i < n; i++) {
			count += x[i];
			if (count <= k) {
				total++;
			}
		}

		System.out.println(total);
		for (int i = 0; i < total; i++) {

			for (int j = 0; j < n; j++) {
				if (x[i] == array[j]) {
					System.out.print(j + 1+" ");
					array[j] = -1;
					break;
				}
			}

		}

		System.out.println();

	}

}

import java.io.*;
import java.util.Collections;
import java.util.Scanner;
import java.util.Vector;

public class Main {

	   static  Vector<Node> lisg = new Vector<Node>() ;
	   static  Vector<Integer>  ans = new Vector<Integer>() ;

	   public  static  void  main(String [] args){
		       int n ,  k ;
		       Scanner sc = new Scanner(System.in) ;
		       while(sc.hasNext()){
		    	       lisg.clear();
		    	       n = sc.nextInt() ;
		    	       k = sc.nextInt() ;
		    	       for(int i = 1 ; i <= n ; i++)  lisg.add(new Node(i , sc.nextInt())) ;
		               Collections.sort(lisg) ;

		               ans.clear() ;
		               int  sum = 0 ;
		               for(int i = 0 ; i < lisg.size()  && sum + lisg.get(i).c <= k ; i++){
		            	         ans.add(lisg.get(i).idx) ;
		            	         sum += lisg.get(i).c ;
		               }
		               System.out.println(ans.size()) ;
		               if(ans.size() > 0){
		                     System.out.print(ans.get(0) );
		            	     for(int i = 1 ; i < ans.size() ; i++) System.out.print(" " + ans.get(i)) ;
		            	     System.out.println() ;
		               }
		       }
	   }

}

class   Node implements Comparable<Node>{
    public int  idx ;
    public int  c  ;

    public Node(){}
    public Node(int idx , int c){
    	   this.idx = idx ;
    	   this.c   =  c ;
    }

	public int compareTo(Node other){
		return  this.c - other.c ;
	}
}

//package contest_23_01_2015;

import java.util.Arrays;
import java.util.Scanner;

public class A {
public static void main(String[] args) {
	 Scanner sc=new Scanner(System.in);
	 int n=sc.nextInt();
	 int k=sc.nextInt();
	 int []a=new int[n];
	 int []b=new int[n];
	 boolean []d=new boolean[n];
	 for (int i = 0; i < b.length; i++) {
		b[i]=a[i]=sc.nextInt();
	}
	 Arrays.sort(a);
	 int y=0;
	 int cnt=0;
	 for (int i =1; i <=n; i++) {
		y+=a[i-1];
		if(y>k){
			break;
		}else{cnt++;
			for (int j = 0; j < d.length; j++) {
				if(a[i-1]==b[j]&&!d[j]){d[j]=true;break;}
			}
		}
	}
	 System.out.println(cnt);
	 for (int i = 0; i < d.length; i++) {
		if(d[i]){
			System.out.print(i+1+" ");
		}
	}
}
}

import java.util.*;
import java.util.ArrayList;
public class Quiz3 {
	public static void main(String args[]) {
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		int k=sc.nextInt();
		int s[]=new int[n];
		ArrayList <Integer> z=new ArrayList <Integer>(1);
		for (int i=0;i<s.length;i++) {
			s[i]=sc.nextInt();
		}
		sc.close();

		int c=0;
		int i=0;
		int x[]=s.clone();
		Arrays.sort(x);
		while (i<s.length) {
			if(c+x[i]<=k) {
				c+=x[i];

				z.add(pos(x[i],s)+1);

				s[pos(x[i],s)]=0;

			}
			i++;}

		System.out.println(z.size());
		for (Integer v :z) {
			System .out.print(v+" ");
		}
	}
	public static int pos(int x,int y[]) {
		int i;
		for(i=0;i<y.length;i++) {
			if (x==y[i])
				break;
		}
		return i;
	}
}

import java.util.Arrays;
import java.util.Scanner;

/**
 * 24-Jan-2015
 * 4:29:30 PM
 * manoj
 */

/**
 * @author manoj
 *
 */
public class Q1287 {
	public static void main(String s[]){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int k =  sc.nextInt();
		int a[] = new int[n];
		int b[] = new int[n];
		for(int i=0;i<n;i++){
			a[i] = b[i] = sc.nextInt();
		}

		Arrays.sort(a);
		int count = -1;
		while(count<n-1){
			if(k<a[count+1]){
				break;
			}else{
				count++;
				k = k - a[count];
			}
		}

		System.out.println(count+1);
		for(int i=0;i<=count;i++){
			for(int j=0;j<n;j++){
				if(a[i]==b[j])
				{
					System.out.print((j+1)+" ");
					b[j] = -1;
					break;
				}
			}
		}
	}

}

import java.util.Scanner;
public class Main {
    static int[] array=new int[5];
    static int[] answer=new int[5];
    static int count=0;
    static void Music(int n,int d){
        int[] a2=new int[n];
        int[] a3=new int[n];
        boolean[] a4=new boolean[n];
        System.arraycopy(array,0,a3,0,n);
        int temp,sum=0;
        for (int j=0;j<n-1;j++) {
            for (int i = 0; i < n-1; i++) {
                if (a3[i] > a3[i + 1]) {
                    temp = a3[i + 1];
                    a3[i + 1] = a3[i];
                    a3[i] = temp;
                }
            }
        }
        a2[0]=0;
        for (int j=0;j<n;j++) {
            sum += a3[j];
            for (int i = 0; i < n; i++) {
                if (a3[j]==array[i]&&sum<=d&&a4[i]==false) {
                    a2[j] = i;
                    a4[i]=true;
                    count++;
                    i=n;
                }
            }
        }
        answer=a2;
    }
    public static void main(String[] args) {
        Scanner in=new Scanner(System.in);
        //System.out.println("Enter the number of instruments :");
        int a=in.nextInt();
        //System.out.println("Enter the number of days :");
        int b=in.nextInt();
        int[] a1=new int[a];
        array=a1;
        for (int i=0;i<a;i++){
            //System.out.println("Enter a["+(i+1)+"] = ");
            a1[i]=in.nextInt();
        }
        //Main m=new Main(a,b);
        Music(a,b);
        System.out.println(count);
        for (int i=0;i<count;i++){
            System.out.print((answer[i]+1)+" ");
        }

    }
}

import java.io.*;
import java.util.*;

public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String q[] = br.readLine().split(" ");
		int n = Integer.parseInt(q[0]);
		int k = Integer.parseInt(q[1]);
		 q = br.readLine().split(" ");
		int a[] = new int[n];
		for(int i=0;i<n;i++ ) a[i] = Integer.parseInt(q[i]);

		int ans[] = new int[n+1];int index = 0;
		while(k>0){
			int min = 101;int j = 0;
			for(int i=0;i<n;i++){
				if(a[i]<min){
					min=a[i];
					j=i;
				}
			}
			if(min<=k && min<101){
				k=k-min;
				a[j] = Integer.MAX_VALUE;
				ans[index] = j+1;
				index++;
			}else{
				break;
			}
		}
		System.out.println(index);
		for(int i=0;i<index;i++) System.out.print(ans[i]+" ");
		System.out.println();
		// end of main
	}

}

import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Comparator;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author angrySCV
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		Scanner in = new Scanner(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskA solver = new TaskA();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskA {
	public void solve (int testNumber, Scanner in, PrintWriter out) {
		int colichestvoInstrumentov = in.nextInt();
		int colichestvoDney = in.nextInt();
		int[][] obuchenie = new int[colichestvoInstrumentov][2];
		for (int i = 0; i < colichestvoInstrumentov; i++) {
			obuchenie[i][0] = in.nextInt();
			obuchenie[i][1] = i;
		}
		int countInstrument = 0;
		int countDay = 0;
		int totalCount = 0;
		Arrays.sort(obuchenie, new Comparator<int[]>() {
			public int compare (int[] o1, int[] o2) {
				return Integer.compare(o1[0], o2[0]);
			}
		});
out:
		for (int i = 0; i < colichestvoInstrumentov; i++) {
			if (countDay + obuchenie[i][0] <= colichestvoDney){
				countDay = countDay+obuchenie[i][0];
				countInstrument++;
			} else break out;
		}
		System.out.println(countInstrument);
		for (int i = 0; i < countInstrument; i++) {
			System.out.print(obuchenie[i][1]+1 + " ");
		}
	}
}

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;

public class AmrAndMusic {
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        int n = s.nextInt();
        int k = s.nextInt();
        int[] a = new int[n + 1];
        int res = 0, days = 0, index = 0;
        ArrayList<Integer> list = new ArrayList();
        for(int i = 1; i <= n; i++) a[i] = s.nextInt();
        for(int i = 1; i <= n; i++) {
            int min = Integer.MAX_VALUE;
            for(int j = 1; j <= n; j++) {
                if(a[j] < min) {
                    min = a[j];
                    index = j;
                }
            }
            a[index] = Integer.MAX_VALUE;
            if(days + min <= k) {
                days += min;
                list.add(index);
                res++;
            }
            index = 0;
        }
        System.out.println(res);
        for(int i = 0; i < list.size(); i++) System.out.print(list.get(i) + " ");
    }
}

import java.util.Scanner;
import java.util.Vector;

public class AmrandMusic{

	public static void main(String args[]){
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();

		int m = in.nextInt();
		int[] a = new int[n];
		int i;
		int si=-1;
		for(i=0;i<n;i++){
			a[i]=in.nextInt();
		}
		int s=a[0];
		for(i=0;i<n;i++) {
			if(s>=a[i]) {
				s=a[i];
				si=i;
			}

		}
		Vector v = new Vector();

		int ans=0;
		int run=1;
		int k=0;
		while(run!=0) {
			if(k<n) {

				if(v.size()==0) {

					if(m>=s) {
						ans++;
//						si=si+1;
						v.add(si);
						m=m-s;
					}else {
						run=0;
					}

				}
				else {
					s=200;
					int usi=-1;
				int j;
					for(j=0;j<n;j++) {
						int nu = a[j];
						if(!v.contains(j)) {
							if(s>=a[j]) {
								s=a[j];
								usi=j;
							}
						}
					}
					if(m>=s) {

					ans++;
					v.add(usi);
					m=m-s;
					}else {
						run=0;
					}
				}
				k++;
			}else {
				run=0;
			}
		}

		System.out.println(ans);
//		System.out.println(v);
		for(i=0;i<v.size();i++) {
			int nu = (int) v.get(i);
//			System.out.print(nu+" "+"asdF");
//			System.out.println();
			nu++;
			System.out.print(nu+" ");
//		System.out.println();
		}

	}

}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;

public class Solution {

	public static void main(String[] args)
    {
		FastReader fr=new FastReader();
		int n=fr.nextInt();
		int k=fr.nextInt();
        int a[]=new int[n];
        //LinkedList<Integer> l=new LinkedList<>();
        HashMap<Integer,LinkedList<Integer>> m=new HashMap<>();
        for(int i=0;i<n;i++) {
        	a[i]=fr.nextInt();
        	if(m.containsKey(a[i])) {
        		m.get(a[i]).add(i+1);
        	}
        	else {
        		LinkedList<Integer> l=new LinkedList<>();
        		l.add(i+1);
        		m.put(a[i],l);
        	}
        }
        Arrays.sort(a);
        int count=0;
        int i=0;
        int sum=0;
        while(i<n) {
        	if((a[i]+sum)<=k) {
        		count++;
        		sum+=a[i];
        	}
        	else
        		break;
        	i++;

        }
       // boolean vis[]=new boolean[n];
        System.out.println(count);
        for(int j=0;j<i;j++) {
        	int val=a[j];
        	int idx=m.get(val).size();
        	System.out.print(m.get(val).get(idx-1)+" ");
        	m.get(val).remove(idx-1);
        }

	}

}
class Pair{
	int val;
	int idx;
	Pair(int val,int idx){
		this.val=val;
		this.idx=idx;
	}
}
class FastReader
{
    BufferedReader br;
    StringTokenizer st;

    public FastReader()
    {
        br = new BufferedReader(new
                InputStreamReader(System.in));
    }

    String next()
    {
        while (st == null || !st.hasMoreElements())
        {
            try
            {
                st = new StringTokenizer(br.readLine());
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
        }
        return st.nextToken();
    }

    int nextInt()
    {
        return Integer.parseInt(next());
    }

    long nextLong()
    {
        return Long.parseLong(next());
    }

    double nextDouble()
    {
        return Double.parseDouble(next());
    }

    String nextLine()
    {
        String str = "";
        try
        {
            str = br.readLine();
        }
        catch (IOException e)
        {
            e.printStackTrace();
        }
        return str;
    }
}

import java.util.Scanner;
import java.util.Arrays;

public class A507_instruments_objectified {

    public static class Instrument implements Comparable<Instrument> {

        private int place;
        private int difficulty;

        public Instrument(int place, int difficulty) {
            super();
            this.place = place;
            this.difficulty = difficulty;
        }

        public int getPlace() {
            return place;
        }

        public void setPlace(int place) {
            this.place = place;
        }

        public int getDifficulty() {
            return difficulty;
        }

        public void setDifficulty(int difficulty) {
            this.difficulty = difficulty;
        }

        // Overriding the compareTo method
        public int compareTo(Instrument d) {
            // return (this.difficulty).compareTo(d.difficulty);
            return Integer.compare(this.difficulty, d.difficulty);
        }

        // Overriding the compare method to sort the age
        public int compare(Instrument d, Instrument d1) {
            return d.difficulty - d1.difficulty;
        }
    }

    @SuppressWarnings("resource")
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int n = input.nextInt();
        int days = input.nextInt();
        Instrument[] instruments = new Instrument[n];

        for (int i = 0; i < instruments.length; i++) {
            instruments[i] = new Instrument(i + 1, input.nextInt());
        }

        Arrays.sort(instruments);
        int learn = 0, left = days;
        for (int i = 0; i < instruments.length; i++) {
            left -= instruments[i].getDifficulty();
            if (left < 0) {
                break;
            } else {
                learn++;
            }
        }
        System.out.println(learn);
        for (int i = 0; i < learn; i++) {
            System.out.print(instruments[i].getPlace() + " ");
        }

    }
}

import java.util.*;

/**
 *
 * @author greggy
 */
public class AmrAndMusic {

    static class Instrument {

        int ins, time;

        Instrument(int ins, int time) {
            this.ins = ins;
            this.time = time;
        }

    }

    public static void main(String[] args) {
        StringBuilder answer = new StringBuilder();
        int count = 0;
        Scanner in = new Scanner(System.in);

        int n = in.nextInt();
        int k = in.nextInt();

        Instrument[] instruments = new Instrument[n];

        for (int i = 0; i < n; i++) {
            int ins = i + 1;
            int time = in.nextInt();
            instruments[i] = new Instrument(ins, time);
        }

        Arrays.sort(instruments, new Comparator<Instrument>() {
            @Override
            public int compare(Instrument o1, Instrument o2) {
                int ans = o1.time - o2.time;
                return ans;
            }
        });

        if (k < instruments[0].time) {
            System.out.print("0");
        } else {

            for (int i = 0; i < n; i++) {
                if (k < instruments[i].time) {
                    break;
                }
                count++;
                answer.append(instruments[i].ins + " ");
                k -= instruments[i].time;
            }
            System.out.println(count);
            System.out.println(answer);
        }

    }

}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.StringTokenizer;

//Your code goes here
public class Main {

	static class ProblemSolver{
		/*
		 * Most necessary data structure storing them in
		 * pairs of days and indices and also having the
		 * capability of sorting them in terms of days
		 */
		class Pair implements Comparable<Pair>{
			int days;
			int index;
			public Pair(int days,int index) {
				this.days=days;
				this.index=index;
			}
			public int compareTo(Pair o) {
				return Integer.compare(this.days, o.days);
			}

		}
		public void solveTheProblem(InputReader in,PrintWriter out){
			//Take necessary inputs
			int n=in.nextInt();
			int total=in.nextInt();
			ArrayList<Pair> pairs=new ArrayList<>();
			for(int index=1;index<=n;++index){
				int days=in.nextInt();
				pairs.add(new Pair(days, index));
			}

			//Sort the necessary inputs in terms of days
			Collections.sort(pairs);

			//Save the number of indices in another list and
			//count the number of days simultaneously
			ArrayList<Integer> instrument=new ArrayList<>();
			int counter=0;
			for(Pair p:pairs){
				if(p.days<=total){
					instrument.add(p.index);
					total-=p.days;
					++counter;
				}else break;
			}

			//Display the result
			out.println(counter);
			for(int i:instrument)out.print(i+" ");
		}
	}

	//Default template for all the codes
	static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream),32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }

	//Template.Main method for all the codes
	public static void main(String[] args) {
		InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
		ProblemSolver problemSolver = new ProblemSolver();
		problemSolver.solveTheProblem(in, out);
		out.close();
	}

}

import java.util.*;

public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        int k = sc.nextInt();

        int[] a = new int[n];

        for(int i=0; i<n; i++) {
            a[i] = sc.nextInt();
        }

        boolean[] selected = new boolean[n];

        ArrayList<Integer> list = new ArrayList<>();

        int total = 0;
        int total_day = 0;

        for(int i=0; i<n; i++) {

            int min = Integer.MAX_VALUE;
            int index = -1;

            for(int j=0; j<n; j++) {

                if(a[j] < min && !selected[j]) {
                    min = a[j];
                    index = j;
                }

            }

            if(total_day+a[index] <= k) {
                total++;
                selected[index] = true;
                list.add(index+1);
                total_day += a[index];
            }

            if(total_day >= k) {
                break;
            }

        }

        System.out.println(total);

        for(int i=0; i<list.size(); i++) {
            System.out.printf("%d ", list.get(i));
        }
        System.out.println();
    }
}

import java.util.Arrays;
import java.util.Comparator;
import java.util.Scanner;

/**
 * Created by Ferrumit on 6/28/2016.
 */
public class _507A {
    public static void main(String args[]) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int k = in.nextInt();
        int a[][] = new int[n][2];
        for(int i=0;i<n;i++){
            a[i][0] = i + 1;
            a[i][1] = in.nextInt();
        }
        Arrays.sort(a, new Comparator<int[]>() {
            @Override
            public int compare(int[] a1, int[] a2) {
                return a1[1] - a2[1];
            }
        });
        String ans = "";
        int count = 0;
        int c = 0;
        for(int i=0;i<n;i++)
            if(a[i][1]+count<=k){
                count+=a[i][1];
                c++;
                ans+=(a[i][0]+" ");
            }
        System.out.print(c + "\n" + ans);
    }
}

import java.util.Arrays;
import java.util.Scanner;
public class AmrAndMusic2
{
    public static void main(String[] args)
    {
        Scanner in = new Scanner (System.in);
        int n = in.nextInt();
        int k = in.nextInt();
        int arr [] = new int [n];
        int sum = 0;
        int i=0;
        int j=0;
        int m=0;
        while (i<n)
        {
            arr[i]=in.nextInt();
            sum+=arr[i];
            i++;
        }
        if (sum<=k)
        {
            System.out.println(n);
            i=1;
            while (i<=n)
            {
                System.out.print(i+" ");
                i++;
            }
            System.out.println("");
        }
        else
        {
            sum=0;
            int copy [] = new int [n];
            i=0;
            while (i<n)
            {
                copy[i]=arr[i];
                i++;
            }
            Arrays.sort(copy);
            i=0;

            while (sum<=k)
            {
                sum+=copy[i];
                i++;
            }
            if (sum>k)
                i--;
            System.out.println(i);
            j=0;
            m=0;
            while (m<i)
            {
                if (j==n)
                    j=0;
                if (arr[j]==copy[m])
                {
                    System.out.print((j+1)+" ");
                     m++;
                }
                j++;
            }
            System.out.println("");

        }
    }

}

import java.util.Arrays;
import java.util.Scanner;

public class AmrAndMusic {

    public static void main(String[] args) {

        long entradaTeclado;
        Scanner teclado = new Scanner(System.in);

        String [] array1 = teclado.nextLine().split(" ");

        String [] array2 = teclado.nextLine().split(" ");

        long n = Long.parseLong(array1[0]);
        long k = Long.parseLong(array1[1]);
        long[] p = new long[array2.length];
        long[] ppp = new long[array2.length];
        long aux;
        long aux2;

        for (int m = 0; m < array2.length; m++) {
            p[m] = Long.parseLong(array2[m]);
            ppp[m] = m+1;
        }

        for(int i=0;i<(p.length);i++){
                        int j;
			for( j=i+1 ; j<p.length ; j++){
				if( p[i] > p[j] ){
					aux = (long) p [i];
                                        aux2 = (long) ppp [i];
					p[i]=p[j];
                                        ppp[i]= ppp[j];
					p[j]= aux;
                                        ppp[j]= aux2;
				}
			}
	}

        long sumatoria = 0;
        for(int i=0;i<(p.length);i++){
                        sumatoria = sumatoria + (long) p[i];
	}

        if (sumatoria <= k){
            System.out.println(n);

            for(int i=0;i<(p.length);i++){
                        System.out.print(i+1 +" ");
            }

        }else{

            if (k<(long) p [0]){
                System.out.println(0);
            }else{

            int a =0;
            int sumadias = 0;

            while (sumadias<k){

            sumadias = sumadias +(int) p [a];
            a = a+1;
            }

                if (sumadias==k){
                    System.out.println(a);

                    for (int m = 0; m < a; m++) {
                    System.out.print(ppp[m] + " ");
                }
                   /* for (int m = 0; m < n; m++) {
                System.out.print(p[m] + " ");}
                */}else{
                System.out.println(a-1);

                for (int m = 0; m < a-1; m++) {
                System.out.print(ppp[m] + " ");
                }
               /* System.out.println(  " termina");

                for (int m = 0; m < n; m++) {
                System.out.println(p[m] + " ");
                } */
            }}
	}

}
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;

public class Main {

	static class Instrument {
		int name;
		int days;

		public Instrument (int name, int days) {
			this.name = name;
			this.days = days;
		}
	}

	public static void main(String[] args) throws IOException {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		PrintWriter out = new PrintWriter(System.out);

		String[] num = in.readLine().split(" ");
		int n = Integer.parseInt(num[0]);
		int k = Integer.parseInt(num[1]);

		num = in.readLine().split(" ");

		List<Instrument> instruments = new ArrayList<Instrument>();
		for (int i=0;i<n;i++) {
			 instruments.add(new Instrument(i+1,Integer.parseInt(num[i])));
		}

		Collections.sort(instruments, new Comparator<Instrument>() {
			public int compare(Instrument i1, Instrument i2) {
				if (i1.days>i2.days) return 1;
				if (i1.days<i2.days) return -1;
				return 0;
			}
		});

		long sum = 0;
		List<Integer> output = new ArrayList<Integer>();
		for (int i=0;i<n;i++) {
			sum+=instruments.get(i).days;
			if (sum<=k) {
				output.add(instruments.get(i).name);
			} else break;
		}

		out.println(output.size());
		for (int i=0;i<output.size();i++) {
			out.println(output.get(i));
		}

		out.close();
	}
}

import java.util.*;

public class AmrMusic507A
{
    public static class Instrument implements Comparable<Instrument>
    {
        public int index;
        public int time;

        public Instrument(int inputindex, int inputtime)
        {
            index = inputindex;
            time = inputtime;
        }

        public int compareTo(Instrument other)
        {
            return this.time - other.time;
        }
    }

    public static void main(String[] args)
    {
        // Set up scanner
        Scanner sc = new Scanner(System.in);
        // System.out.println("Enter n");
        int n = sc.nextInt();
        // System.out.println("Enter k");
        int k = sc.nextInt();

        Instrument[] a = new Instrument[n];   // But adjust indices later
        for (int i=0; i<n; i++)
        {
            // System.out.println("Enter time of next instrument");
            int t = sc.nextInt();
            Instrument inst = new Instrument(i, t);
            a[i] = inst;
        }

        Arrays.sort(a);

        int i = 0;
        int totaltime = 0;
        int number = 0;
        StringBuilder sb = new StringBuilder();
        while (i < n && totaltime <= k)
        {
            totaltime = totaltime + a[i].time;
            if (totaltime <= k)
            {
                sb.append((a[i].index + 1) + " ");
                number++;
                i++;
            }
        }
        if (totaltime > k)
        {
            totaltime = totaltime - a[i].time;
            System.out.println(number);
            System.out.println(sb);
            return;
        }
        else      // All the way through the array
        {
            System.out.println(n);
            System.out.println(sb);
        }
    }
}

import java.util.*;
import java.io.*;

public class cf507a {

    public static void main(String[] args) {

        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int k = in.nextInt();
        pair[] a = new pair[n];

        for (int i = 0; i < n; i++) {
            a[i] = new pair(in.nextInt(), i + 1);
        }

        Arrays.sort(a);
        Set<Integer> set = new HashSet<Integer>();

        for (int i = 0; i < n; i++) {
            if (k - a[i].s >= 0) {
                k -= a[i].s;
                set.add(a[i].i);
            }
        }

        if (set.size() > 0) {
            System.out.println(set.size());
            for (Integer integer : set) {
                System.out.print(integer + " ");
            }
            System.out.println("");
        } else {
            System.out.println(0);
        }

    }

    static class pair implements Comparable<pair> {

        int s;
        int i;

        public pair(int s, int i) {
            this.s = s;
            this.i = i;
        }

        @Override
        public int compareTo(pair t) {
//            return t.s - s;
            return s - t.s;
        }

    }

}

import java.util.*;

public class CF507A {
    public static class Pair{
        int a;
        int b;
        Pair(int a,int b){
            this.a=a;
            this.b=b;
        }
    }

    public static void main(String[] args) {
        Scanner s=new Scanner(System.in);
        int n=s.nextInt();
        int k=s.nextInt();
        int[] arr=new int[n];
        ArrayList<Pair> tmp=new ArrayList<Pair>();
        for(int i=0;i<n;i++){
            arr[i]=s.nextInt();
            tmp.add(new Pair(arr[i],i));
        }
        Collections.sort(tmp,(p1,p2)->p1.a-p2.a);
        int count=0;
        long sum=0;
        for(Pair p:tmp){
            int num=p.a;
            if(sum+num<=k){
                sum=sum+num;
                count++;
            }
            else{
                break;
            }
        }
        System.out.println(count);
        for(int i=0;i<count;i++){
            System.out.print(tmp.get(i).b+1+" ");
        }
        System.out.println();
    }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.StringTokenizer;

public class A {
  FastScanner in;
  PrintWriter out;

  public void run() {
    try {
      in = new FastScanner(new InputStreamReader(System.in));
      out = new PrintWriter(System.out);
      solve();
      out.close();
    } catch (IOException e) {
      e.printStackTrace();
    }
  }

  public void solve() throws IOException {
    int n = in.nextInt();
    int k = in.nextInt();
    int [] a = new int[n];
    for (int i=0; i<n; i++) {
      a[i] = in.nextInt();
    }
    int min = 0;
    int minIndex = 0;
    int counter = 0;
    ArrayList<Integer> ll = new ArrayList<Integer>();
    for (int i=0; i<n; i++) {
      min = Integer.MAX_VALUE;
      for (int j=0; j<n; j++) {
        if (a[j] > 0 && a[j] < min) {
          min = a[j];
          minIndex = j;
        }
      }

      if (k >= a[minIndex]) {
        k -= a[minIndex];
        counter++;
        ll.add(minIndex+1);
        a[minIndex] = -1;
      } else {
        break;
      }
    }
    out.println(counter);
    for (int i : ll) {
      out.print(i + " ");
    }
    out.println();
  }

  class FastScanner {
    BufferedReader br;
    StringTokenizer st;

    FastScanner(InputStreamReader in) {
      br = new BufferedReader(in);
    }

    String nextLine() {
      String str = null;
      try {
        str = br.readLine();
      } catch (IOException e) {
        e.printStackTrace();
      }

      return str;
    }

    String next() {
      while (st == null || !st.hasMoreTokens()) {
        try {
          st = new StringTokenizer(br.readLine());
        } catch (IOException e) {
          e.printStackTrace();
        }
      }
      return st.nextToken();
    }

    int nextInt() {
      return Integer.parseInt(next());
    }
  }

  public static void main(String[] arg) {
    A o = new A();
    o.run();
  }

}

import java.util.Scanner;
public class MyClass {

     public static void quickSort(int[][] arr, int lo, int hi)
     {
         if(lo<hi)
         {
             int p = partition(arr,lo,hi);
             int right;
             for(right = p + 1; right<hi;right++)
             {
                 if(arr[right][0] != arr[p][0])
                     break;
             }
             quickSort(arr,lo,p-1);
             quickSort(arr,right,hi);
         }
     }

     public static int partition(int[][] arr, int lo, int hi)
     {
         int pivot = arr[lo + (hi - lo)/2][0];
         int cur = pivot;
         int curi = arr[lo + (hi - lo)/2][1];
         arr[lo + (hi - lo)/2][0] = arr[hi][0];
         arr[hi][0] = cur;
         arr[lo + (hi - lo)/2][1] = arr[hi][1];
         arr[hi][1] = curi;
         int index = lo;
         for(int i = lo; i <hi; i++)
         {
             if(arr[i][0] < pivot)
             {
                 cur = arr[index][0];
                 curi = arr[index][1];
                 arr[index][0] = arr[i][0];
                 arr[index][1] = arr[i][1];
                 arr[i][0] = cur;
                 arr[i][1] = curi;
                 index++;
             }
         }
         cur = arr[index][0];
         curi = arr[index][1];
         arr[index][0] = arr[hi][0];
         arr[index][1] = arr[hi][1];
         arr[hi][0] = cur;
         arr[hi][1] = curi;
         return index;
     }

     public static void main(String[] args) {
     Scanner scan = new Scanner(System.in);
     int n = scan.nextInt();
     int days = scan.nextInt();
     int[][] arr = new int[n][2];

     for(int i =0; i < n; i++)
     {
         arr[i][0] = scan.nextInt();
         arr[i][1] = i+1;
     }

     quickSort(arr, 0, n-1);
     int count = 0;

     while(count < n)
     {
         if(arr[count][0] <= days)
         {
             days = days - arr[count][0];
             count++;
         }
         else
             break;
     }

     System.out.println(count);
     if(count>0)
     {
         System.out.print(arr[0][1]);
         for(int i = 1; i<count;i++)
         {
             System.out.print(" " + arr[i][1]);
         }
     }
  }

}

import java.util.*;
import java.io.*;
import java.math.*;

public class test {

static class InputReader {
    public BufferedReader reader;
    public StringTokenizer tokenizer;

    public InputReader(InputStream stream) {
        reader = new BufferedReader(new InputStreamReader(stream), 32768);
        tokenizer = null;
    }

    public String next() {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(reader.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken();
    }

    public int nextInt() {
        return Integer.parseInt(next());
    }

    public long nextLong() {
	return Long.parseLong(next());
    }

}

static class Pair implements Comparable<Pair> {
  public final int first, second;

  public Pair(int first, int second) {
    this.first = first;
    this.second = second;
  }

  @Override
  public String toString() {
   return "(" + first + "," + second + ")";
  }

@Override
  public boolean equals(Object o) {
    if (this == o) return true;
    if (o == null || getClass() != o.getClass()) return false;

    Pair Pair = (Pair) o;

    return first == Pair.first && second == Pair.second;

  }

@Override
  public int hashCode() {
    int result = first;
    result = 31 * result + second;
    return result;
  }

  public int compareTo(Pair o) {
    if (first < o.first)
    return -1;
    if (first > o.first)
    return 1;
    if (second < o.second)
    return -1;
    if (second > o.second)
    return 1;
    return 0;
  }

}

 static class Task {

	public void solve(int testNumber, InputReader in, PrintWriter out) {
  		while(testNumber-->0) {
			int n = in.nextInt();
			int k = in.nextInt();
			ArrayList<Pair> list = new ArrayList<Pair>();
			for(int i=0;i<n;++i)
				list.add(new Pair(in.nextInt(),i+1));

			Collections.sort(list);
			int ans = 0;
			ArrayList<Integer> idx = new ArrayList<Integer>();
			int days=0;
			int sz=0;
			for(int i=0;i<n;++i)
				if(days+list.get(i).first<=k) {
					idx.add(list.get(i).second); ++sz;
					days += list.get(i).first;
				}

			out.println(sz);
			for(int i=0;i<sz;++i)
				out.print(idx.get(i)+" ");
			out.println();
    		}
	}

}

    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Task solver = new Task();
        int test  = 1;
        solver.solve(test, in, out);
        out.close();
    }

}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Comparator;
import java.util.StringTokenizer;

public class ProbA {

    public static void main(String args[]) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        SolverA.InputReader in = new SolverA.InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        SolverA solver = new SolverA();
        int testCount = 1;
        for (int i = 1; i <= testCount; i++) {
            solver.solve(in, out);
        }
        out.close();
    }
}

class Pair {
    int a, b;

    Pair(int a, int b) {
        this.a = a;
        this.b = b;
    }
}

class SolverA {

    public void solve(InputReader in, PrintWriter out) {
        int n = in.nextInt();
        int k = in.nextInt();

        Pair a[] = new Pair[n];

        for (int i=0; i<n; i++) {
            a[i] = new Pair(in.nextInt(), i+1);
        }

        Comparator<Pair> comp = new Comparator<Pair>() {
            @Override public int compare(final Pair o1, final Pair o2) {
                return o1.a - o2.a;
            }
        };

        Arrays.sort(a, comp);

        int i = 0;
        while (k > 0 && i < n) {
            if (k >= a[i].a) {
                k -= a[i].a;
                i++;
            } else {
                break;
            }
        }
        out.println(i);
        for (int j=0; j<i; j++) {
            out.print(a[j].b + " ");
        }
        out.println();
    }

    static class InputReader {
        private final BufferedReader reader;
        private StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream));
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }
    }
}

//package codeforces;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

public class A507 {

    static class Pair implements Comparable<Pair> {
        int day, index;

        public Pair(int day, int index) {
            this.day = day;
            this.index = index;
        }

        @Override
        public int compareTo(Pair o1) {
            return this.day - o1.day;
        }

        @Override
        public String toString() {
            return "Pair{" +
                    "day=" + day +
                    ", index=" + index +
                    '}';
        }
    }

    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        String[] inputMeta = br.readLine().split(" ");

        int n = Integer.parseInt(inputMeta[0]);
        int k = Integer.parseInt(inputMeta[1]);

        List<Pair> instruments = new ArrayList<>();

        inputMeta = br.readLine().split(" ");

        for (int i = 0; i < inputMeta.length; i++) {
            instruments.add(new Pair(Integer.parseInt(inputMeta[i]), i + 1));
        }

        Collections.sort(instruments);

        int instrumentCount = 0;
        StringBuilder indexes = new StringBuilder();

        for (Pair cInstrument : instruments) {
            if (cInstrument.day <= k) {
                instrumentCount++;
                indexes.append(cInstrument.index).append(" ");

                k -= cInstrument.day;
            }
        }

        System.out.println(instrumentCount);
        System.out.println(indexes.substring(0, Math.max(0, indexes.length() - 1)));
    }
}

import java.io.*;
import java.util.*;
public class Main {
    final static long mod = (long)10e9+7;
    public static void main(String[] args) {
        InputReader sc = new InputReader(System.in);
        PrintWriter pw = new PrintWriter(System.out);
        Random gen = new Random();
        int test = 1;//sc.nextInt();
        while(test-->0) {
            int n = sc.nextInt();
            int k = sc.nextInt();

            int c = 0;
            ArrayList<Data> list = new ArrayList<>();
            StringBuffer sb = new StringBuffer();
            for(int i=0;i<n;i++)
            {
                list.add(new Data(sc.nextInt(),i));
            }
            Collections.sort(list);
            for(int i=0;i<list.size();i++)
            {
                if(k-list.get(i).x>=0)
                {
                    k-=list.get(i).x;
                    c++;
                    sb.append(list.get(i).a+1).append(" ");
                }
                else
                    break;
            }
            if(c==0)
                pw.println(0);
            else
                pw.println(c+"\n"+sb);

        }
        pw.close();

    }

    static class Data implements Comparable<Data>{
        int x, a;

        public Data (int m, int n) {
            x = m;
            a = n;
        }
        @Override
        public int compareTo(Data o) {
            return x - o.x;
        }
    }

    static class InputReader {

        private final InputStream stream;
        private final byte[] buf = new byte[8192];
        private int curChar, snumChars;

        public InputReader(InputStream st) {
            this.stream = st;
        }

        public int read() {
            if (snumChars == -1)
                throw new InputMismatchException();
            if (curChar >= snumChars) {
                curChar = 0;
                try {
                    snumChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (snumChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

        public int nextInt() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public long nextLong() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            long res = 0;
            do {
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public int[] nextIntArray(int n) {
            int [] a = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = nextInt();
            }
            return a;
        }

        public static int[] shuffle(int[] a, Random gen)
        { for(int i = 0, n = a.length;i < n;i++)
        { int ind = gen.nextInt(n-i)+i;
            int d = a[i];
            a[i] = a[ind];
            a[ind] = d;

        }
            return a;
        }

        public String readString() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                c = read();
            } while (!isSpaceChar(c));
            return res.toString();
        }

        public String nextLine() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                c = read();
            } while (!isEndOfLine(c));
            return res.toString();
        }

        public boolean isSpaceChar(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        private boolean isEndOfLine(int c) {
            return c == '\n' || c == '\r' || c == -1;
        }

    }

}

import java.util.ArrayList;
import java.util.Scanner;
public class JavaApplication39 {
    public int index , num;
    public ArrayList<JavaApplication39> BubbleSort(ArrayList<JavaApplication39> a) {
        for (int i = 0; i < a.size() ; i++) {
            for (int j = 0; j < a.size()-1 ; j++) {
                if (a.get(j).num > a.get(j+1).num ) {
                    JavaApplication39 obj = new JavaApplication39();
                    int temp = a.get(j).num;
                    int tmpIndex = a.get(j).index;

                    obj.num = a.get(j+1).num;
                    obj.index = a.get(j+1).index;
                    a.set(j, obj);
                    obj = new JavaApplication39();
                    obj.num = temp;
                    obj.index = tmpIndex;
                    a.set(j+1 , obj);

                }
            }
        }
        return a;
    }
    public static void main(String[] args) {

        int n , k , a;
        JavaApplication39 ob = new JavaApplication39();
        ArrayList  list = new ArrayList();
        ArrayList<JavaApplication39> num = new ArrayList<JavaApplication39>();
        Scanner in = new Scanner(System.in);
        n = in.nextInt();
        k = in.nextInt();
        for (int i = 1; i <= n; i++) {
            a = in.nextInt();
            ob = new JavaApplication39();
            ob.num = a;
            ob.index = i;
            num.add(ob);
        }
        num = ob.BubbleSort(num);

        for (int i = 0; i < n; i++) {
            int key = (int) num.get(i).num;

            if( key <= k && key != 0){
                 k = k - key;
                 list.add(num.get(i).index);
            }

        }

        System.out.println(list.size());
        list.sort(null);
        for (int i = 0; i < list.size(); i++) {
            if( i == list.size()-1){
                System.out.println(list.get(i));
                return;
            }
            System.out.print(list.get(i) + " ");
        }
    }

}

import java.io.*;
import java.util.*;

public class Main {

    public static void main(String[] args) throws IOException {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        InputReader.OutputWriter out = new InputReader.OutputWriter(outputStream);

        int n = in.nextInt();
        int k = in.nextInt();
        Point [] points = new Point[n];
        for (int i = 0; i < n; i++) {
            points[i] = new Point(i+1,in.nextInt());
        }
        Arrays.sort(points, Comparator.comparingInt(Point::getValue));
        int sum = 0;
        int index = -1;
        for (int i = 0; i < points.length; i++) {
            if(sum+points[i].getValue()<=k) {
                sum+=points[i].getValue();
                index = i;
            }
            else break;
        }
        out.println(index + 1);
        for (int i = 0; i <=index; i++) {
            out.print(points[i].getIndex() + " ");
        }
        out.flush();
    }
    static boolean isPalindrome(char [] c) {
        int i = 0;
        int j = c.length - 1;
        while (i<=j) {
            if(c[i]!=c[j]) return false;
            i++;
            j--;
        }
        return true;
    }
    static boolean isPrime(long n) {
        for (long i = 2; i*i<=n; i++) {
            if(n%i==0) return false;
        }
        return  true;
    }
    static void  reverse(int [] a, int i,int j) {
        while (i<=j) {
            int temp = a[i];
            a[i] = a[j];
            a[j] = temp;;
            i++;
            j--;
        }
    }
    static int gcd(int a,int b) {
        return b == 0 ? a : gcd(b,a%b);
    }
}
class Point {
    int index;
    int value;

    public int getIndex() {
        return index;
    }

    public int getValue() {
        return value;
    }
    public Point(int index,int value) {
        this.index = index;
        this.value = value;
    }
}

class InputReader extends BufferedReader {
    StringTokenizer tokenizer;

    public InputReader(InputStream inputStream) {
        super(new InputStreamReader(inputStream), 32768);
    }

    public InputReader(String filename) {
        super(new InputStreamReader(Thread.currentThread().getContextClassLoader().getResourceAsStream(filename)));
    }

    public String next() {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(readLine());
            } catch (IOException e) {
                throw new RuntimeException();
            }
        }
        return tokenizer.nextToken();
    }

    public Integer nextInt() {
        return Integer.valueOf(next());
    }
    public Long nextLong() {return  Long.valueOf(next());}

    static class OutputWriter extends PrintWriter {
        public OutputWriter(OutputStream outputStream) {
            super(outputStream);
        }

        public OutputWriter(Writer writer) {
            super(writer);
        }

        public OutputWriter(String filename) throws FileNotFoundException {
            super(filename);
        }

        public void close() {
            super.close();
        }
    }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.StringTokenizer;

public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskC solver = new TaskC();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskC {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
        	int n = in.nextInt();
        	int timeLeft = in.nextInt();
        	ArrayList<Integer> days = new ArrayList<>();
        	ArrayList<Integer> indices[] = new ArrayList[101];
        	for (int i=0;i<101;i++){
        		indices[i] = new ArrayList<>();
        	}
        	for (int i=0;i<n;i++){
        		int a = in.nextInt();
        		days.add(a);
        		indices[a].add(i+1);
        	}
        	Collections.sort(days);
        	int numOfInstruments = 0;
        	while(timeLeft>0 && numOfInstruments<days.size()){
        		timeLeft -= days.get(numOfInstruments);
        		if (timeLeft>=0){
        			numOfInstruments++;
        		} else
        			break;
        	}
        	out.println(numOfInstruments);
        	for (int j=0;j<101;j++){
    			for (int i=0;i<indices[j].size();i++){
    				if (numOfInstruments>0){
    					numOfInstruments--;
    					out.print((indices[j].get(i)) + " ");
    				} else
    					break;
    			}
        	}
        }
    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}

import java.util.*;
public class music{
    public static void main(String[] args){
        Scanner inp = new Scanner(System.in);
        int n,days;
        int count=0;
        n= inp.nextInt();
        days = inp.nextInt();
        int[] arr = new int[n];
        int[] darr= new int[n];
        for(int i=0;i<n;i++){
            arr[i] = inp.nextInt();
            darr[i] = arr[i];
        }
        Arrays.sort(arr);
        for(int i=0;i<n;i++){
            days = days - arr[i];
            if(days>=0){
                count++;
            }
        }
        System.out.println(count);
        int i =0;
        int[] copy = new int[count];
        while(count>i){
            int j=0;
            while(n>j){
                if(count>i){
                    if(arr[i]==darr[j]){
                        copy[i] = j+1;
                        i++;
                    }
                }

                j++;
            }
        }
        Arrays.sort(copy);
        for(int j:copy){
            System.out.print(j+" ");
        }

        inp.close();

     }
}

import java.util.List;
import java.util.Scanner;
import java.io.OutputStream;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Collections;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		Scanner in = new Scanner(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskA solver = new TaskA();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskA {
    public void solve(int testNumber, Scanner in, PrintWriter out) {
        int n = in.nextInt();
        int k = in.nextInt();

        int []indexes = new int[n];
        int []a = new int[n];
        for (int i = 0; i < n; ++i){
            a[i] = in.nextInt();
            indexes[i] = i + 1;
        }

        for (int i = 0; i < n; ++i)
            for (int j = i + 1; j < n; ++j)
                if (a[i] > a[j]){
                    int t = a[i];
                    a[i] = a[j];
                    a[j] = t;
                    t = indexes[i];
                    indexes[i] = indexes[j];
                    indexes[j] = t;
                }
        int index = 0;
        ArrayList<Integer> result = new ArrayList<Integer>();
        while ( index < n && (k = k - a[index++]) >= 0)
            result.add(indexes[index - 1]);

        Collections.sort(result);

        out.println(result.size());
        for (int x : result)
            out.print(x + " ");
    }
}

import java.util.Arrays;
import java.util.Scanner;

public class lab507a {
    public static void main(String args[]) {
        Scanner in = new Scanner(System.in);
        int n=in.nextInt();
        int k=in.nextInt();
        int d=0;
        int[] a=new int[n];
        int[] b=new int[n];
        for (int i=0;i<n;i++){
            a[i]=in.nextInt();
        }
        int[] c = new int[n];
        System.arraycopy(a, 0, c, 0, n);
        Arrays.sort(a);
        int j=0;
        if(a[0]>k){
            System.out.print(0);
        }else {
            while (k > 0) {

                if((k-a[j])<0)break;
                for (int i = 0; i < n; i++) {
                    if ((c[i] == a[j]) && (c[i] > 0)) {
                        b[j] = i + 1;
                        c[i] = 0;
                        break;
                    }
                }
                d++;
                k = k - a[j];
                j++;
                if(j==n)break;
            }
            System.out.println(d);
            for (int i=0;i<n;i++){
                if((b[i]==0))break;
                System.out.print(b[i]+" ");

            }
        }

    }
}

//coderadi
//virtual 288
import java.io.*;
import java.util.*;

public class A {
	public static void main(String[] args)throws IOException {
		Scanner sc = new Scanner(System.in);
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		int n = sc.nextInt();
		int k = sc.nextInt();

		Pair[] ar = new Pair[n];
		int temp = -1;
		for(int i=0; i<n; i++){
			temp = sc.nextInt();
			ar[i] = new Pair(temp, i);
		}

		Arrays.sort(ar, new Comparator<Pair>(){
			public int compare(Pair one, Pair two){
				return Integer.compare(one.getX(), two.getX());
			}
		});

		ArrayList<Integer> ans = new ArrayList<Integer>(n);
		for(int i=0; i < n; i++){
			if(ar[i].getX() <= k){
				k = k - ar[i].getX();
				ans.add(ar[i].getPos());
			}
		}
		System.out.println(ans.size());
		for(int i=0; i<ans.size(); i++)
			System.out.print((ans.get(i) + 1) + " ");
		System.out.println();
	}
}

class Pair{
	private int x, pos;

	Pair(int x, int pos){
		setX(x);
		setPos(pos);
	}

	public void setX(int x){
		this.x = x;
	}

	public void setPos(int pos){
		this.pos = pos;
	}

	public int getX(){
		return x;
	}

	public int getPos(){
		return pos;
	}
}

import java.util.Arrays;
import java.util.Scanner;

/**
 * Created by sherxon on 2/26/15.
 */
public class A507 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n= in.nextInt();
        int k= in.nextInt();
        pair [] a= new pair[n];

        for (int i = 0; i < a.length; i++)
            a[i]=new pair(i+1, in.nextInt());
        Arrays.sort(a);
        int sum=0;
        int i = 0;
        //System.out.println(Arrays.toString(a));

        for (; i <a.length; i++) {
            sum +=a[i].getValue();
            if(sum>k)break;
        }
        System.out.println(i);
        for (int j = 0; j <i; j++)
            System.out.print(a[j].getIndex() + " ");

    }

    private static class pair implements Comparable{
       private int index;
       private int value;

        @Override
        public String toString() {
            return index + " " + value;
        }

        public pair(int index, int value) {
            this.index = index;
            this.value = value;
        }

        public int getIndex() {
            return index;
        }

        public void setIndex(int index) {
            this.index = index;
        }

        public int getValue() {
            return value;
        }

        public void setValue(int value) {
            this.value = value;
        }

        @Override
        public int compareTo(Object o) {
            pair temp=(pair)o;
            return  this.getValue()-temp.getValue();
        }
    }
}

/* package whatever; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */

public class Main
{
 		public static void main (String[] args) throws java.lang.Exception
	{
		Scanner scan=new Scanner(System.in);
		int n=scan.nextInt();
		int k=scan.nextInt();
		int a,b;
		DS[] array=new DS[n];
		for(int i=0;i<n;i++)
		{
			a=scan.nextInt();
			b=i+1;
			array[i]=new DS(a,b);
		}

		Arrays.sort(array, new Comparator<DS>(){
			public int compare(DS ds1, DS ds2){
				return new Integer(ds1.a1).compareTo(new Integer(ds2.a1));
			}
			});

		int count=0;
		while(count<n && (k-array[count].a1)>=0)
		{
			k=k-array[count].a1;
			count++;
		}

		System.out.println(count);
		for(int i=0;i<count;i++)
			System.out.print(array[i].a2+" ");
	}
}

class DS
{
	int a1;
	int a2;

	DS(int a1,int a2)
	{
		this.a1=a1;
		this.a2=a2;
	}
}

import java.util.Arrays;
import java.util.Scanner;
public class Main {
   public static void main(String args[] ) throws Exception {
      Scanner input = new Scanner(System.in);
          int n  =input.nextInt() , k = input.nextInt();
          Integer ins[] = new Integer [n];

          for(int i = 0; i<ins.length;i++){
              ins[i]=input.nextInt();
          }
              Integer insc [] = new Integer [n];
              System.arraycopy(ins, 0, insc, 0, ins.length);
//              for (int i = 0; i < insc.length; i++) {
//           insc[i] = ins[i];
//
//       }
              Arrays.sort(insc);
              int  c = 0 ; String answer ="";
              for (int i = 0,j=0; i < insc.length; i++) {
                    if(k-insc[i] >=0)
                    {
                        k-=insc[i];
                        c++;
                        answer+= 1+(Arrays.asList(ins).indexOf(insc[i]))+" ";
                        if(Arrays.asList(ins).indexOf(insc[i])!=-1)
                            ins[Arrays.asList(ins).indexOf(insc[i])]=null;
                        j++;
                    }

                  }
               System.out.println(c);
                 System.out.println(answer);
       }

             }

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;

public class A_Div2_287 {
    public static void main(String[]arg) throws IOException
    {
        new A_Div2_287().solve();
    }
    public void solve() throws IOException
    {
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st =  new StringTokenizer(in.readLine());
        int n = Integer.parseInt(st.nextToken());
        int k = Integer.parseInt(st.nextToken());
        Day[]a = new Day[n];
        st = new StringTokenizer(in.readLine());
        for(int i = 0;i < n; i++)
        {
            int kday = Integer.parseInt(st.nextToken());
            a[i] = new Day(i, kday);
        }
        Arrays.sort(a);
        boolean end = false;
        int i = 0;
        int ins = 0;
        String ans = "";
        while(!end && i < n)
        {
            Day d = a[i];
            int minus = k - d.kday;
            if(minus >= 0)
            {
                k -= d.kday;
                i++;
                ans += (d.i + 1) + " ";
                ins++;
            }
            else
            {
                end = true;
            }
        }
        System.out.println(ins);
        if(ins > 0)
            System.out.println(ans.trim());
    }
    public class Day implements Comparable<Day>
    {
        int kday;
        int i;
        public Day(int i, int k)
        {
            this.i = i;
            kday = k;
        }
        public int compareTo(Day o) {
            if(kday > o.kday)
                return 1;
            else if(kday < o.kday)
                return -1;
            return 0;
        }

    }
}

import java.util.Arrays;
import java.util.Comparator;
import java.util.Scanner;

/**
 * Created by Ferrumit on 6/28/2016.
 */
public class _507A {
    public static void main(String args[]) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int k = in.nextInt();
        int a[][] = new int[n][2];
        for(int i=0;i<n;i++){
            a[i][0] = i + 1;
            a[i][1] = in.nextInt();
        }
        Arrays.sort(a, new Comparator<int[]>() {
            @Override
            public int compare(int[] a1, int[] a2) {
                return a1[1] - a2[1];
            }
        });
        String ans = "";
        int count = 0;
        int c = 0;
        for(int i=0;i<n;i++)
            if(a[i][1]+count<=k){
                count+=a[i][1];
                c++;
                ans+=(a[i][0]+" ");
            }
        System.out.print(c + "\n" + ans);
    }
}

import java.util.Arrays;
import java.util.Scanner;

public class music {
    public static void main(String[] args) {
        int n,m=0,max=0,flag=0;
        int ind=0;
        String nk[];
        String a="";
        long k;
        Scanner In = new Scanner(System.in);
        String input1=In.nextLine();
        String input2=In.nextLine();
        nk=input1.split(" ");
        n=Integer.parseInt(nk[0]);
        k=Integer.parseInt(nk[1]);
        nk=input2.split(" ");
        int[] q =new int[nk.length];
        for(int i=0;i<nk.length;i++){
            q[i]=Integer.parseInt(nk[i]);

        }
         Arrays.sort(q);
         int[] f=new int[nk.length];
        Arrays.fill(f, 0);
        for (int i =0;i<q.length;i++){
            max=max+q[i];
            if(max>k){
                System.out.println(m);
                System.out.println(a);
                flag=1;
                break;
            }
            else{
                m++;
                for(int j=0;j<nk.length;j++){
                    if(q[i]==Integer.parseInt(nk[j])&&f[j]==0){
                        ind=j+1;
                        f[j]=1;
                        break;
                    }

                }
                a=a+ind+" ";

            }
        }
        if(flag==0){
            System.out.println(m);
            System.out.println(a);
        }

    }

}

/**
 * Created by Marcos on 31/12/2016.
 */

import java.io.*;
import java.util.Arrays;
import java.util.Comparator;
import java.util.Scanner;
import java.util.StringTokenizer;

public class dfsa implements Comparable<dfsa> {
    private int p,i;
    public dfsa(int p,int i){
        this.p=p;
        this.i=i;
    }
    public int compareTo(dfsa o){
        return this.p-o.p;
    }

    public static void main(String[] args) {
        InputReader in = new InputReader(System.in);
        int n=in.nextInt();
        int k=in.nextInt();
        dfsa[] a = new dfsa[n];
        for(int i=0; i<n; i++)
        {
            a[i]=new dfsa(in.nextInt(), i+1);
        }
        Arrays.sort(a);
        int indice=0;
        int sum=0;
        for(int i=0; i<a.length; i++){
            sum+=a[i].p;
            if(sum<=k){
                indice=i;
            }else
                break;
        }
        System.out.println("suma es : " + sum + " e indice es : " +indice);
        if(indice==0){
            System.out.println(0);
        }else{
            for(int i =0; i<=indice;i++){
                System.out.print(a[i].i + " ");
            }
        }

        }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}

//package com.company;

import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int d = sc.nextInt();
        int totalSongTime  = 0;
        for(int i=0;i<n;i++){
            totalSongTime+=sc.nextInt();
        }
        if(totalSongTime+((n-1)*10)>d){
            System.out.println(-1);
        }
        else{
            int rem = d - totalSongTime;
            System.out.print(rem/5);
        }
    }
}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;

public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskC solver = new TaskC();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskC {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
        	int n = in.nextInt();
        	int timeLeft = in.nextInt();
        	int x = 0;
        	ArrayList<Integer> indices = new ArrayList<>();
        	int[] instrumentLearn = new int[101];
        	for (int i=0;i<n;i++){
        		instrumentLearn[in.nextInt()]++;
        	}
        	for (int i=1;i<=100;i++){
    			if (timeLeft>0){
    				timeLeft -= i;
    				if (timeLeft>=0){
    					x++;
    					indices.add(i);
    				}
    			}
        	}
        	out.println(x);
        	for (int i=0;i<indices.size();i++){
        		out.print(indices.get(i) + " ");
        	}
        }
    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}

		import java.util.*;
		public class mohamedy23
		{

		    public static void main (String args[])
		    {
		    	Scanner sc=new Scanner(System.in);
		        int n=sc.nextInt();
		        int m=sc.nextInt();
		        int a[]=new int[n];
		        String d="";
		        for(int i=0;i<n;i++) {
		        	a[i]=sc.nextInt();d+=a[i]+" ";
		        }
		       ArrayList<Integer>as=new ArrayList<>();
		       for(int i=0;i<a.length;i++) {
		    	   as.add(a[i]);
		       }

		        Arrays.sort(a);int c2=0;int s2=0;String b="";
		        for(int i=0;i<a.length;i++) {
		        	if(c2+a[i]<=m) {
		        		c2+=a[i];s2++;
		        		int k=as.indexOf(a[i]);
		        		b+=k+" ";
		        		as.set(k,101);

		        	}
		        }
		       System.out.println(s2);
		       System.out.println(b);
		    }
		    }

import java.util.*;
import java.io.*;

public class Solution{

	public static void main(String [] args) throws IOException{

		boolean flag = false;

		Scanner s = new Scanner(System.in);

		int n = s.nextInt();
		int k = s.nextInt();

		int [] A = new int[n];

		int [] index = new int[n+1];

		for(int i=0;i<n;i++){
			A[i] = s.nextInt();
			index[A[i]] = i+1;
		}

		Arrays.sort(A);

		for(int i: A){
			if(k-i>=0){
				System.out.print(index[i] + " ");
				k-=i;
				flag = true;
			}
			else
				break;

		}

		if(!flag)
			System.out.print(0);

	}
}

import java.io.*;
import java.util.*;

public class Numbers
{
      public static void main(String[] args) throws IOException
	{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer(br.readLine());

            int n,k;
            n = Integer.parseInt(st.nextToken());
            k = Integer.parseInt(st.nextToken());
            int[] daysNeededToLearn = new int[n];
            st = new StringTokenizer(br.readLine());
            for(int i=0; i<n; i++)
                  daysNeededToLearn[i] = Integer.parseInt(st.nextToken());
            Arrays.sort(daysNeededToLearn);

            ArrayList<Integer> instrumentLearnt = new ArrayList<>();
            for(int i=0; i<n && k-daysNeededToLearn[i]>0; i++)
            {
                  k -= daysNeededToLearn[i];
                  instrumentLearnt.add(daysNeededToLearn[i]);
            }

            System.out.println(instrumentLearnt.size());
            for(int i=0; i<instrumentLearnt.size(); i++)
                  System.out.print(daysNeededToLearn[i] + " ");
	}
}

import java.util.Arrays;
import java.util.Scanner;
import java.util.Arrays;
public class teas {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int k = in.nextInt();
        int sum = 0;int i=0;
        int[] a = new int[n];
        for (i = 0; i < n; i++) {
            a[i] = in.nextInt();
            sum += a[i];
        }
        int []b=new int [n];
        b=Arrays.copyOf(a, n);
        Arrays.sort(a);
        i=n-1;
         while(sum>k){
             sum-=a[i];
             i--;
         }
         System.out.println(i+1);
        for (int j=0; j<=i;j++) {
            System.out.print(b[j] + " ");
        }
    }
}

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.*;

public class Main {

    public static void main(String[] args) {
        try {
            BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
            String[] s = in.readLine().split(" ");
            int instrNum = Integer.parseInt(s[0]);
            int dayNum = Integer.parseInt(s[1]);
            Instr[] instrArray = new Instr[instrNum];
            String[] instrStrArray = in.readLine().split(" ");
            for (int i = 0; i < instrNum; i++) {
                instrArray[i] = new Instr(Integer.parseInt(instrStrArray[i]), i + 1);
            }
            Arrays.sort(instrArray);
            List<Integer> indexes = new LinkedList<Integer>();
            int index = 0;
            while (true) {
                if (index == instrNum) {
                    break;
                }
                Instr curInstrument = instrArray[index];
                dayNum -= curInstrument.getDays();
                if (dayNum >= 0) {
                    indexes.add(curInstrument.getIndex());
                } else {
                    break;
                }
                index++;
            }

            int size = indexes.size();
            System.out.println(size);
            StringBuilder builder = new StringBuilder();
            for (int i = 0; i< size; i++) {
                if (i == (size - 1)) {
                    builder.append(indexes.get(i));
                } else {
                    builder.append(indexes.get(i)).append(" ");
                }
            }
        } catch (Exception e) {
            // nothing
        }
    }

    private static class Instr implements Comparable<Instr> {

        private int days;
        private int index;

        private Instr(int days, int index) {
            this.days = days;
            this.index = index;
        }

        @Override
        public int compareTo(Instr o) {
            return (days < o.getDays()) ? -1 : 1;
        }

        private int getDays() {
            return days;
        }

        private int getIndex() {
            return index;
        }
    }
}

import java.util.*;
public class Demo {

    public static void main(String[] args) {
        // TODO Auto-generated method stub
        int n , k , aii ,sum = 0 ,sum2=0 ,re=0;
        ArrayList<Integer> ai = new ArrayList<Integer>();
        ArrayList<Integer> ai2 = new ArrayList<Integer>();
        Scanner input = new Scanner(System.in);
        n = input.nextInt();
        k = input.nextInt();
        if (k == 0){
            System.out.println(re);
            return ;
        }

        for (int i = 0; i < n; i++) {
            aii = input.nextInt();
            ai.add(aii);
        }

        for (int i = 0; i < ai.size(); i++) {
            sum = sum + ai.get(i);
            if ( sum <= k){
                ai2.add(i+1);
                re++;
                sum2 = sum;
            }
            else{
                sum = sum2;
            }
        }
            System.out.println(re);
        for (int i = 0; i < ai2.size(); i++) {

                System.out.print(ai2.get(i) + " ");
        }

    }

}

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayDeque;
import java.util.Arrays;
import java.util.Queue;
import java.util.StringTokenizer;

public class Amr_And_Music {
	public static void main(String[] args)throws Throwable {
		BufferedReader bf=new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st=new StringTokenizer(bf.readLine());
		st.nextToken();
		int time=Integer.parseInt(st.nextToken());
		st=new StringTokenizer(bf.readLine());
		pair [] nums = new pair [st.countTokens()];
		for(int i=0;st.hasMoreTokens();i++)
			nums[i]=new pair(Integer.parseInt(st.nextToken()), i);
		Arrays.sort(nums);
		int count=0;
		Queue q=new ArrayDeque<Integer>();
		for(int i=0;i<nums.length;i++)
		{
			if(time>=nums[i].x)
			{
				time-=nums[i].x;
				count++;
				q.add(nums[i].y);
			}
			else
				break;
		}
		System.out.println(count);
		while(!q.isEmpty())
			System.out.print(q.poll()+" ");
	}
	static class pair implements Comparable<pair>
	{
		int x;
		int y;
		pair(int x,int y)
		{
			this.x=x;
			this.y=y;
		}
		public int compareTo(pair o) {
			return x-o.x;
		}
	}
}

/* package whatever; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
public class Ideone
{
	public static void main (String[] args) throws java.lang.Exception
	{
		// your code goes here
Scanner sc=new Scanner(System.in);
int n=sc.nextInt();
int k=sc.nextInt();
int[] a=new int[n];
int[] b=new int[n];
int c=0;

for(int i=0;i<n;i++)
{
a[i]=sc.nextInt();
b[i]=a[i];
}

Arrays.sort(a);
int sum=0;
for(int i=0;i<n;i++)
{
sum+=a[i];
if(sum<=k)
c++;
else
break;
}
System.out.println(c);
boolean[] vis=new boolean[n];
for(int i=0;i<c;i++)
{
int c1=a[i];
for(int j=0;j<n;j++)
{
if((b[j]==c1) && (vis[j]==false))
{vis[j]=true;
System.out.print((j+1)+" ");
}
}
}
	}
}

import java.util.*;
public class A
{
    public static class Pair
    {
        int f;
        int s;
    };
    public static void main(String args[])
    {
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        int k=sc.nextInt();
        ArrayList<Pair> arr=new ArrayList<>();
        ArrayList<Integer> pp=new ArrayList<>();
        for(int i=0;i<n;i++)
        {
            int x=sc.nextInt();
            Pair p=new Pair();
            p.f=x;
            p.s=(i+1);
            arr.add(p);
        }
        Collections.sort(arr,new Comparator<Pair>()
        {
            public int compare(Pair a, Pair b)
            {
                return a.f-b.f;
            }
        });
        for(int i=0;i<arr.size();i++)
        {
            //System.out.println(arr.get(i).f);
            if(k>0)
            {
                k=k-arr.get(i).f;
                if(k<=0)
                break;
                pp.add(arr.get(i).s);
            }
        }
        System.out.println(pp.size());
        for(int i=0;i<pp.size();i++)
        {
            System.out.print(pp.get(i)+" ");
        }
        System.out.println();
    }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Scanner;
import java.util.StringTokenizer;

/**
 *
 * @author Ahmad
 */
public class JavaApplication1 {

    public static void main (String[] args) throws IOException, Exception {
      FastReader console = new FastReader();
      int n = console.nextInt() ;
      int m = console.nextInt() ;
      int x[] = new int [n] ;
      int y[] = new int [n] ;
      for (int i=0 ; i<x.length ; i++){
          x[i]=console.nextInt() ;
          y[i]=x[i] ;
      }
      int count = 0 ;
      Map<Integer,Integer> map = new HashMap<>() ;
      Arrays.sort(x);
      int sum = 0 ;
      for (int i=0 ; i<x.length ; i++){
          sum+=x[i] ;
          if (sum<=m){
              if (map.containsKey(x[i])){
                  int f = map.get(x[i]) ;
                  map.put(x[i], f+1) ;
              }
              else {
                  map.put(x[i], 1) ;
              }
          }
          else {
              break ;
          }
      }
      StringBuilder br = new StringBuilder() ;
      for (int i=0 ; i<y.length ; i++){
          if (map.containsKey(y[i])){
              count ++ ;
              br.append((i+1)+"\n") ;
              if (map.get(y[i])<=1){
                  map.remove(y[i]) ;
              }
              else {
                  int f = map.get(y[i]) ;
                  map.put(x[i], f-1) ;
              }
          }
      }
        System.out.println(count);
        br.trimToSize();
        System.out.print(br);
   }
}
class FastReader {

    BufferedReader br;
    StringTokenizer st;

    public FastReader() {
        br = new BufferedReader(new InputStreamReader(System.in));
    }
    String next() {
        while (st == null || !st.hasMoreElements()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return st.nextToken();
    }

    int nextInt() {
        return Integer.parseInt(next());
    }

    long nextLong() {
        return Long.parseLong(next());
    }

    double nextDouble() {
        return Double.parseDouble(next());
    }

    String nextLine() {
        String str = "";
        try {
            str = br.readLine();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return str;
    }
}

/**
 *   Author: Ridam Nagar
 *   Date: 27 February 2019
 *   Time: 01:17:36
**/
/*
package codechef; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;
import java.math.BigInteger;

/* Name of the class has to be "Main" only if the class is public. */
public class Codechef
{

    public static void main (String[] args) throws java.lang.Exception
    {
    	Scanner sc=new Scanner(System.in);
          int n=sc.nextInt();
          int k=sc.nextInt();
          int arr[]=new int[n];
          for(int i=0;i<n;i++){
               arr[i]=sc.nextInt();
          }
         int brr[]=arr.clone();
         int result[]=new int[n];
              Arrays.sort(brr);
              int count=0;
              int sum=0;
              for(int i=0;i<arr.length;i++){
              	sum=sum+brr[i];

              	if(sum<=k){
              		count++;
              		 for(int j=0;j<arr.length;j++){
              	if(arr[j]==brr[i]){
              		result[i]=j+1;
              	}
              }
              	}else{
              		break;
              	}
              }
              System.out.println(count);
              Arrays.sort(result);
              for(int i=0;i<result.length;i++){
              	if(result[i]!=0)
              	System.out.print(result[i]+" ");
              }

}

}

import java.util.Arrays;
import java.util.Collections;
import java.util.Scanner;

public class Music {

    /**
     * @param args
     */
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int[] data = null;
        int[] dest = null;
        int num = in.nextInt();
        int days = in.nextInt();
        int value = 0, numElement = 0, count = 0;
        boolean first = false;
        data = new int[num];
        dest = new int[num];
        for (int i = 0; i < num; i++) {
            data[i] = in.nextInt();
        }
        System.arraycopy(data, 0, dest, 0, data.length);
        Arrays.sort(data);
        for (int i = 0; i < data.length; i++) {
            value = data[i];
            days = days - value;
            if (days == 0) {
                numElement = i + 1;
                break;
            }
            if (days < 0) {
                numElement = i;
                break;
            }
        }
        System.out.println(numElement);
        for (int i = 0; i < dest.length; i++) {
            for (int j = 0; j < numElement; j++) {
                if (dest[i] == data[j]) {
                    if (first) {
                        System.out.print(" ");
                        System.out.print(i + 1);
                        count++;
                    } else {
                        System.out.print(i + 1);
                        first = true;
                        count++;
                    }
                    break;
                }
            }
            if(count==numElement) break;
        }
        System.out.println();
    }

}

/**
 * Created by Marcos on 31/12/2016.
 */

import java.io.*;
import java.util.Arrays;
import java.util.Comparator;
import java.util.Scanner;
import java.util.StringTokenizer;

public class dfsa implements Comparable<dfsa> {
    private int p,i;
    public dfsa(int p,int i){
        this.p=p;
        this.i=i;
    }
    public int compareTo(dfsa o){
        return this.p-o.p;
    }

    public static void main(String[] args) {
        InputReader in = new InputReader(System.in);
        int n=in.nextInt();
        int k=in.nextInt();
        dfsa[] a = new dfsa[n];
        for(int i=0; i<n; i++)
        {
            a[i]=new dfsa(in.nextInt(), i+1);
        }
        Arrays.sort(a);
        int indice=0;
        int sum=0;
        for(int i=0; i<a.length; i++){
            sum+=a[i].p;
            if(sum<=k){
                indice=i;
            }else
                break;
        }

        if(indice == 0 && sum==0){
            System.out.println(0);
        }else{
            if(indice==0 && sum!=0){
                System.out.println(indice+1);
                System.out.print(a[0].i);
            }else{
                System.out.println(indice+1);
                for(int i =0; i<=indice;i++){
                    System.out.print(a[i].i + " ");
                }
            }
        }

        }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}

import java.util.Arrays;
import java.util.Scanner;

public class Problem1 {
    public static class node implements Comparable<node>{
        int index;
        int num;

        public node( int index, int num){
            this.index=index;
            this.num=num;
        }
        @Override
        public int compareTo(node o) {
            // TODO Auto-generated method stub
            return num-o.num;
        }
    }

    public static void main(String[] args) {
        // TODO Auto-generated method stub
        Scanner scan=new Scanner(System.in);
        int n= scan.nextInt();
        int k= scan.nextInt();
        node[] ar = new node[n];
        for(int i=0; i<n; i++){
            int a =scan.nextInt();
            ar[i]= new node(i+1,a);
        }
        Arrays.sort(ar);
        int i=0;
        int sum=0;
        while(sum+ ar[i].num<k){
            sum += ar[i].num;
            i++;
        }
        System.out.println(i+1);
        for(int j=0; j<=i; j++) System.out.print( ar[j].index + " " );
    }
}

import java.util.Scanner;

public class teas {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int k = in.nextInt();
        int sum = 0;int i=0;
        int[] a = new int[n];
        for (i = 0; i < n; i++) {
            a[i] = in.nextInt();
            sum += a[i];
        }
        insertionSort(a);
        i=n-1;
         while(sum>k){
             sum-=a[i];
             i--;
         }
         sum=0;
        /* for (int j=i; j>=0;j--) {
            sum += a[j];
    }*/  System.out.println(i+1);
        for (int j=i; j>=0;j--) {
            System.out.print(a[j] + " ");
        }
    }

    public static void insertionSort(int[] a) {
        int in, out;
        for (out = 1; out < a.length; out++)
        {
            int temp = a[out];
            in = out;
            while (in > 0 && a[in - 1] >= temp)
            {
                a[in] = a[in - 1];
                --in;
                a[in] = temp;
            }

        }
    }
}

import java.lang.reflect.Array;
import java.util.Arrays;
import java.util.Scanner;

/**
 * Created by Петруча on 23.01.2015.
 */
public class Main {
    public static void main(String[] args) {

        Scanner s = new Scanner(System.in);
        int c = 101;
        int index = 0;
        int counter=0;
        int suma=0;
        int n = s.nextInt();
        int k = s.nextInt();
        int[] a = new int[n + 1];
        int [] b=new int [n+1];
        boolean[] peka = new boolean[n + 1];
        Arrays.fill(peka, true);

        for (int i = 1; i < n + 1; i++) {
            a[i] = s.nextInt();
            b[i]=a[i];
        }

Arrays.sort(a);
        for(int i=1;i<n+1;i++){
            suma=suma+a[i];
            if(suma<=k){
                counter++;

            }
            else{
                break;

            }

        }
        System.out.println(counter);

        for (int j = 0; j < counter; j++) {

            for (int i = 1; i < n + 1; i++) {
                if (peka[i]) {
                    if (b[i] < c) {
                        c = b[i];
                        index = i;
                       // System.out.println(index);
                    }

                }
            }

            System.out.println(index);
            peka[index] = false;
            c=100;

        }
    }
}

import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;

public class Main {
    FastScanner in = new FastScanner();
    PrintWriter out;

    private class Instr {
        public int n;
        public int a;
    }

    public void solve() throws IOException {
        int N = in.nextInt();
        int K = in.nextInt();

        Instr instrs[] = new Instr[N];

        for (int n = 0; n < N; n++) {
            Instr instr = new Instr();
            instr.n = n;
            instr.a = in.nextInt();
            instrs[n] = instr;
        }

        Arrays.sort(instrs, new Comparator<Instr>() {
            public int compare(Instr a, Instr b) {
                return Integer.compare(a.a, b.a);
            }
        });

        int sum = 0;
        int n;
        for (n = 0; n < N; n++) {
            if (sum + instrs[n].a > K) {
                break;
            }

            sum += instrs[n].a;
        }

        System.out.println(n);
        for (int i = 0; i < n; i++) {
            System.out.print((instrs[i].a + 1) + " ");
        }

        System.out.println();

    }

    public void run() {
        try {
            solve();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    class FastScanner {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st;

        String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        int read() throws IOException {
            return br.read();
        }
    }

    // http://stackoverflow.com/questions/521171/a-java-collection-of-value-pairs-tuples
    public class Pair<L,R> {

      private final L left;
      private final R right;

      public Pair(L left, R right) {
        this.left = left;
        this.right = right;
    }

    public L getLeft() { return left; }
    public R getRight() { return right; }

    @Override
    public int hashCode() { return left.hashCode() ^ right.hashCode(); }

    @Override
    public boolean equals(Object o) {
        if (o == null) return false;
        if (!(o instanceof Pair)) return false;
        Pair pairo = (Pair) o;
        return this.left.equals(pairo.getLeft()) &&
        this.right.equals(pairo.getRight());
    }

}

public static void main(String[] arg) {
    new Main().run();
}
}

import java.io.*;
import java.util.Collections;
import java.util.Scanner;
import java.util.Vector;

public class Main {

	   static  Vector<Node> lisg = new Vector<Node>() ;
	   static  Vector<Integer>  ans = new Vector<Integer>() ;

	   public  static  void  main(String [] args){
		       int n ,  k ;
		       Scanner sc = new Scanner(System.in) ;
		       while(sc.hasNext()){
		    	       lisg.clear();
		    	       n = sc.nextInt() ;
		    	       k = sc.nextInt() ;
		    	       for(int i = 1 ; i <= n ; i++)  lisg.add(new Node(i , sc.nextInt())) ;
		               Collections.sort(lisg) ;

		               ans.clear() ;
		               int  sum = 0 ;
		               for(int i = 0 ; i < lisg.size()  && sum + lisg.get(i).c <= k ; i++){
		            	         ans.add(lisg.get(i).idx) ;
		            	         sum += lisg.get(i).idx ;
		               }
		               System.out.println(ans.size()) ;
		               if(ans.size() > 0){
		                     System.out.print(ans.get(0) );
		            	     for(int i = 1 ; i < ans.size() ; i++) System.out.print(" " + ans.get(i)) ;
		            	     System.out.println() ;
		               }
		       }
	   }

}

class   Node implements Comparable<Node>{
    public int  idx ;
    public int  c  ;

    public Node(){}
    public Node(int idx , int c){
    	   this.idx = idx ;
    	   this.c   =  c ;
    }

	public int compareTo(Node other){
		return  this.c - other.c ;
	}
}

import java.io.BufferedReader;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.StringTokenizer;

public class A43 {
    public static void main(String [] args) {
        InputStream inputReader = System.in;
        OutputStream outputReader = System.out;
        InputReader in = new InputReader(inputReader);
        PrintWriter out = new PrintWriter(outputReader);
        Algorithm solver = new Algorithm();
        solver.solve(in, out);
        out.close();
    }
}

class Algorithm {
    void solve(InputReader ir, PrintWriter pw) {
        int n = ir.nextInt();
        int k = ir.nextInt();
        int [] a = new int[n];
        int [] b;

        for (int i = 0; i < n; i++) a[i] = ir.nextInt();
        b = a;
        sort(a, 0, n - 1);

        int ans = 0, next = 0, index = 0;
        for (int i = 0; i < n; ++i) {
            next += a[i];
            if (next > k) break;
            ans++;index = i;
        }
        pw.println(ans);
        if (ans != 0) for(int i = 0; i <= index; ++i) {
            for (int j = 0; j < n; ++j) {
                if(a[i] == b[j]){pw.print((j + 1) + " ");b[j] = -1; break;}
            }
        }

    }
    private static void sort(int[] array, int low, int high) {

        int i = low;
        int j = high;
        int x = array[low + (high - low) / 2];

        do {
            while (array[i] < x) ++i;
            while (array[j] > x) --j;
            if (i <= j) {
                int tmp = array[i];
                array[i] = array[j];
                array[j] = tmp;
                i++;
                j--;
            }
        } while (i <= j);

        if (low < j) sort(array, low, j);
        if (i < high) sort(array, i, high);

    }
}

class InputReader {
    private BufferedReader reader;
    private StringTokenizer tokenizer;

    InputReader(InputStream stream) {
        reader = new BufferedReader(new InputStreamReader(stream), 32768);
        tokenizer = null;
    }

    String next() {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(reader.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken();
    }

    int nextInt() {
        return Integer.parseInt(next());
    }

}

import java.util.Scanner;

/**
 ** Created by Alik on 11/8/2015.
 */
public class Problem_507A {
    public static void main(String[] args){
        Scanner in = new Scanner(System.in);
        int number = in.nextInt();
        int days = in.nextInt();
        int[] array = new int[number];

        for (int i = 0; i < array.length; i++)
            array[i] = in.nextInt();

        String result="";
        int count = 0;
        int temp = 0;
        int lookFor = 1;
        while (temp <= days && lookFor <= 100){
            for (int i = 0; i < array.length; i++){
                if (array[i] == lookFor){
                    if (temp+lookFor <= days) {
                        temp += lookFor;
                        result += (i+1) + " ";
                        count++;
                    }
                }
            }
            lookFor++;
        }
        if (result.equals(""))
            result = "0";
        System.out.println(count);
        System.out.print(result);
    }
}

/**
 *
 * @author Faruk
 */

import java.util.Arrays;
import java.util.Scanner;
import java.util.HashSet;
import java.util.HashMap;
import java.util.ArrayList;

public class tmp {
    public static void main(String [] args){
        Scanner scan = new Scanner(System.in);

        int n = scan.nextInt();
        int k = scan.nextInt();
        int [] data = new int[n];

        for(int i=0; i<n; i++)
            data[i] = scan.nextInt();

        StringBuilder out = new StringBuilder();

        int sum = 0;
        int cur=1;
        int ctn = 0;

        for(int i=1; i<100; i++){
            for(int j=0; j < n; j++){
                if(data[j] == i && sum+i <= k){
                    ctn++;
                    sum += i;
                    data[j] = -1;
                    out.append((j+1)+ " ");
                }
            }
        }
        System.out.println(ctn+"\n"+ out.toString());

    }

}

import java.util.Scanner;
import java.util.Vector;

public class AmrandMusic{

	public static void main(String args[]){
	Scanner in = new Scanner(System.in);
	int n = in.nextInt();

	int m = in.nextInt();
	int[] a = new int[n];
	int i;
	for(i=0;i<n;i++){
	a[i]=in.nextInt();
	}
	int sm=a[0];
	int ans=0;
	Vector ar = new Vector();
	int k=0;
	for(i=0;i<n;i++){
	if(a[i]<sm)sm=a[i];
	}
//	System.out.println(ar);
	int run=1;
	while(run==1){
		sm=200;
		int inf=-1;
		for(i=0;i<n;i++)		{
			if(!ar.contains(i)) {
				if(sm>=a[i]) {
					sm=a[i];
					inf=i;
				}
			}
		}

		if(m>=sm) {
			ans++;
			ar.add(inf);
			m=m-sm;
		}else {
			run=0;
		}

	}

		System.out.println(ans);
//		System.out.println(ar);
		for(i=0;i<ar.size();i++) {
			int nu = (int) ar.get(i);
			nu=nu+1;
			System.out.print(nu+" ");
		}

	}

}

import java.util.Arrays;
import java.util.Scanner;

/**
 * Created by nursultan on 8/12/15.
 */
public class Test48 {

    static void define(int[] a, int days) {

        int m = 0;

        int cnt = 0;

        String indces = "";
        int[] b = a.clone();
        Arrays.sort(a);

        for (int i = 0; i < a.length; i++) {
            if (cnt + a[i] < days) {
                cnt += a[i];
                m++;
            }
        }

        // obhod
        for (int i = 0; i < m; i++) {
            for (int j = 0; j < b.length; j++) {
                if (a[i] == b[j]) {
                    indces = indces + (j + 1) + " ";
                    b[j] = -1;
                }
            }
        }
        System.out.println(m);
        System.out.println(indces);

    }

    public static void main(String[] args) {

        Scanner in = new Scanner(System.in);

        int n = in.nextInt();
        int d = in.nextInt();
        int[] a = new int[n];

        for (int i = 0; i < n; i++) {
            a[i] = in.nextInt();
        }

        define(a, d);

    }

}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Scanner;
public class Main {
 public static void main(String[] args){
    Scanner sc=new Scanner(System.in);
int n=sc.nextInt();
int k=sc.nextInt();
int a[]=new int[n];
for(int i=0;i<n;i++)
    a[i]=sc.nextInt();

int b[]=a;int m=0,s=0;
Arrays.sort(a);
for(int i=0;i<n;i++){
    s=s+a[i];
    if(s>k)break;
    else
        m++;
}
System.out.println(m);
for(int i=0;i<m;i++)
{
    for(int j=0;j<n;j++){
        if(b[j]==a[i])
            System.out.print((j+1)+" ");
    }
}

    }
 }

import java.util.Scanner;
import java.util.Arrays;
import java.util.Comparator;

public class Amr{
    public static void main(String args[]){
        Scanner scan = new Scanner(System.in);

        int numInstruments = scan.nextInt();
        int numDays = scan.nextInt();

        Instrument[] instruments = new Instrument[numInstruments];

        for(int i=0;i<numInstruments;i++){
            instruments[i] = new Instrument(scan.nextInt(), i+1);
        }

        Arrays.sort(instruments, new Comparator<Instrument>(){
           public int compare(Instrument a, Instrument b){
               return Integer.compare(a.days, b.days);
           }
        });

        int daysToLearn = 0;

        int i = 0;
        for(i=0;i<numInstruments && daysToLearn < numDays;i++){
            daysToLearn += instruments[i].days;
        }

        System.out.println(i+1);

        for(int j=0;j<i;j++){
            System.out.print(instruments[j].index + " ");
        }
    }
}

class Instrument{
    int days;
    int index;

    public Instrument(int days, int index){
        this.days = days;
        this.index = index;
    }
}

import java.util.*;
public class Demo {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		int n , k , aii ,sum = 0 ,sum2=0 ,re=0;
		ArrayList<Integer> ai = new ArrayList<Integer>();
		ArrayList<Integer> ai2 = new ArrayList<Integer>();
		Scanner input = new Scanner(System.in);
		n = input.nextInt();

		k = input.nextInt();
		for (int i = 0; i < n; i++) {
			aii = input.nextInt();
			ai.add(aii);
		}
		if (k == 0){
			System.out.println(re);
			return ;
		}

		for (int i = 0; i < ai.size(); i++) {
			sum = sum + ai.get(i);
			if ( sum <= k){
				ai2.add(i+1);
				re++;
				sum2 = sum;
			}
			else{
				sum = sum2;
			}
		}
			System.out.println(re);
		for (int i = 0; i < ai2.size(); i++) {

				System.out.print(ai2.get(i) + " ");
		}

	}

}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;

public class Main {

    public void solve(){

        int n = in.nextInt();
        int k = in.nextInt();

        Pair[] days = new Pair[n];

        for(int i = 0; i< n; i++){
            days[i] = new Pair( in.nextInt(), i);
        }
        Arrays.sort(days);
        int sum = 0;
        int i;
        for(i = 0; i< n ; i++){

            if(days[i].x + sum > k){
                break;
            }
            sum += days[i].x;
        }

        out.println(i);

        for(int j = 0; j<i;j++){
            out.print(days[j].y );
            if( j < i-1){
                out.print(" ");
            }
        }

    }

    public static void main(String[] args){
        Main m = new Main();
        m.solve();
        m.out.flush();
        m.out.close();
    }

    InputStream inputStream;
    OutputStream outputStream;
    InputReader in;
    PrintWriter out;

    public Main(){
        inputStream = System.in;
        outputStream = System.out;
        in = new InputReader(inputStream);
        out = new PrintWriter(outputStream);
    }

}

class InputReader {
    public BufferedReader reader;
    public StringTokenizer tokenizer;

    public InputReader(InputStream stream) {
        reader = new BufferedReader(new InputStreamReader(stream), 32768);
        tokenizer = null;
    }

    public String next() {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(reader.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }

        return tokenizer.nextToken();
    }
    public String nextLine(){
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(reader.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        String s = "";
        while(tokenizer.hasMoreTokens()){
            s += tokenizer.nextToken();
            if(tokenizer.hasMoreTokens()){
                s+=" ";
            }
        }

        return s;

    }

    public int nextInt() {
        return Integer.parseInt(next());
    }
    public double nextDouble(){
        return Double.parseDouble(next());
    }

    public long nextLong(){
        return Long.parseLong(next());
    }

    public float nextFloat(){
        return Float.parseFloat(next());
    }

}
class Pair implements Comparable<Pair>{

    int x;
    int y;

    public Pair(int a, int b){
        x = a;
        y = b;
    }

    @Override
    public int compareTo(Pair o) {

        return Integer.compare(x, o.x);
    }
}

import java.util.Arrays;
import java.util.Scanner;

public class Driver {

	public static Scanner scanner;

	public static void main(String[] args) {

		scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		int k = scanner.nextInt();
		int[] daysNeeded = new int[n];
		int[] instrumentsId = new int[n];
		int count=0;
		int result = 0;
		for(int i=0; i<n; i++) {
			daysNeeded[i] = scanner.nextInt();
		}

		Arrays.sort(daysNeeded);

		for(int i=0; i<n; i++) {
			if(count+daysNeeded[i] <= k) {
				instrumentsId[i] = (i+1);
				count+=daysNeeded[i];
				result++;
			}
		}

		System.out.println(result);
		for(int i : instrumentsId) {
			if(i != 0)
				System.out.print(i+" ");
		}

	}

}

import java.util.*;
public class ArmrMusic{
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		StringBuilder sb = new StringBuilder("");
		int ni = in.nextInt();
		int days = in.nextInt();
		int it[] = new int[ni];
		List<Integer> temp = new ArrayList<Integer>();
		int learnCount = 0;
		int cur_days = 0;

		for(int i = 0; i < ni; i++){
			it[i] = in.nextInt();
			temp.add(it[i]);
		}
		Arrays.sort(it);
		for(int j = 0; j < ni;j++){
			if((cur_days=it[j]+cur_days) <= days){
				learnCount++;
				sb.append(temp.indexOf(it[j])+" ");
				System.out.println("index : "+temp.indexOf(it[j])+"value is :"+it[j]);
				temp.set(temp.indexOf(it[j]),-1);
			}
		}
		System.out.println(learnCount);
		if(learnCount > 0){
			System.out.println(sb);
		}
	}
}

import java.util.Arrays;
import java.util.Scanner;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		Scanner in = new Scanner(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskB solver = new TaskB();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskB {

    char[] cmp(char[] a, char[] b){
        for (int i = 0; i < a.length; ++i){
            if (Character.getNumericValue(a[i])>Character.getNumericValue(b[i])) return a;
            else if (Character.getNumericValue(b[i])>Character.getNumericValue(a[i])) return b;
        }
        return null;
    }

    String toString(char[] a){
        StringBuilder temp = new StringBuilder();
        for (char i : a){
            temp.append(i);
        }
        return temp.toString();
    }
    public void solve(int testNumber, Scanner in, PrintWriter out) {
        String n = in.next();
        char[] data = n.toCharArray();
        String ans = "-1";
        char[] best = new char[data.length];
        Arrays.fill(best,'0');
        for (int i = 0; i < n.length()-1; ++i){
            if (Character.getNumericValue(data[i])%2==0){
                char[] temp3 = new char[data.length];
                System.arraycopy(data,0,temp3,0,data.length);
                temp3[n.length()-1]=data[i];
                temp3[i]=data[n.length()-1];
                if (cmp(best,temp3)==temp3){
                    System.arraycopy(temp3,0,best,0,temp3.length);
                    ans = toString(temp3);
                }
            }
        }

        out.println(ans);
    }
}

import java.util.Arrays;
import java.util.Scanner;
public class AmrAndMusic2
{
    public static void main(String[] args)
    {
        Scanner in = new Scanner (System.in);
        int n = in.nextInt();
        int k = in.nextInt();
        int arr [] = new int [n];
        int sum = 0;
        int i=0;
        int j=0;
        int m=0;
        while (i<n)
        {
            arr[i]=in.nextInt();
            sum+=arr[i];
            i++;
        }
        if (sum<=k)
        {
            System.out.println(n);
            i=1;
            while (i<=n)
            {
                System.out.print(i+" ");
                i++;
            }
            System.out.println("");
        }
        else
        {
            sum=0;
            int copy [] = new int [n];
            i=0;
            while (i<n)
            {
                copy[i]=arr[i];
                i++;
            }
            Arrays.sort(copy);
            i=0;
            while (sum<=k)
            {
                sum+=copy[i];
                i++;

            }
             if (sum>k)
                    i--;
            System.out.println(i);

            while (m<i)
            {
                if (j==n)
                    break;
                if (arr[j]==copy[m])
                {
                    System.out.println(j+1);
                     m++;
                }
                j++;

            }

        }
    }

}

import java.util.*;
public class AmrAndMusic {

	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt(),k=sc.nextInt();int a[]=new int[n];for(int i=0;i<n;i++)a[i]=sc.nextInt();
		List<Integer> l=new ArrayList<>();
		for(int i=0;i<n;i++) {
			if(k-a[i]>=0 && k>=0) {
				k-=a[i];
				l.add(i+1);
			}
		}
		System.out.println(l.size());
		for(int e: l) {
			System.out.print(e+" ");
		}

	}

}

import java.io.*;
import java.util.*;

public class Smile {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out);
		int n = in.nextInt();
		int m = in.nextInt();
		int[] a = new int[n];
		int[] b = new int[n];
		for (int i = 0; i < n; i++) {
			a[i] = in.nextInt();
			b[i] = i + 1;
		}
		for (int i = 0; i < n - 1; i++) {
			for (int j = 0; j < n - 1; j++) {
				if (a[i] > a[i + 1]) {
					int temp = a[i];
					a[i] = a[i + 1];
					a[i + 1] = temp;
					temp = b[i];
					b[i] = b[i + 1];
					b[i + 1] = temp;
				}
			}
		}
		int sum = 0;
		boolean flag = false;
		for (int i = 0; i < n; i++) {
			sum += a[i];
			if (sum <= m) {
				flag = true;
				out.print(b[i] + " ");
			} else {
				break;
			}
		}
		if (!flag) {
			out.println(0);
		}
		out.close();
	}
}

import java.util.Arrays;
import java.util.Scanner;

/**
 * Created by nursultan on 8/12/15.
 */
public class Test48 {

    static void define(int[] a, int days) {

        int m = 0;

        int cnt = 0;

        String indces = "";
        int[] b = a.clone();
        Arrays.sort(a);

        for (int i = 0; i < a.length; i++) {
            if (cnt + a[i] <= days) {
                cnt += a[i];
                m++;
            }
        }

        // obhod
        for (int i = 0; i < m; i++) {
            for (int j = 0; j < b.length; j++) {
                if (a[i] == b[j]) {
                    indces = indces + (j + 1) + " ";
                    b[j] = -1;
                }
            }
        }
        System.out.println(m);
        System.out.println(indces);

    }

    public static void main(String[] args) {

        Scanner in = new Scanner(System.in);

        int n = in.nextInt();
        int d = in.nextInt();
        int[] a = new int[n];

        for (int i = 0; i < n; i++) {
            a[i] = in.nextInt();
        }

        define(a, d);

    }

}

import sun.reflect.generics.tree.Tree;

import java.io.*;
import java.util.*;

/**
 * Created by babdelfattah on 7/27/2016.
 */
public class Test {

    static class FastReader
    {
        BufferedReader br;
        StringTokenizer st;

        public FastReader()
        {
            br = new BufferedReader(new
                    InputStreamReader(System.in));
        }

        String next()
        {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException  e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt()
        {
            return Integer.parseInt(next());
        }

        long nextLong()
        {
            return Long.parseLong(next());
        }

        double nextDouble()
        {
            return Double.parseDouble(next());
        }

        String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }

    }

    static boolean visited[] = new boolean[1000010];
    static int level[] = new int[100];

    public static void main(String[] args)  {

        Scanner in = new Scanner(System.in);
        int n=in.nextInt();
        int k=in.nextInt();
        String s ="";
        int a [] = new int[n];
        for(int i =0; i<n;i++)
        {
            a[i]=in.nextInt();
            s+=a[i];
        }
        Arrays.sort(a);
        int x=0,v=0;
        String ans="";
        for(int i =0; i<n;i++)
        {
            if(x+a[i]<=k)
            {
                x+=a[i];
                ans+=s.indexOf(a[i]+"")+1+" ";
                s=s.replaceFirst(a[i]+"","p");
                v++;
            }
            else
                break;
        }
        System.out.println(v);
        System.out.println(ans.trim());

    }

    static int s=0;
    public static void dfs( ArrayList<ArrayList<Integer>> list,int v )
    {
        s++;
        visited[v]=true;
        for(int w : list.get(v))
            if(!visited[w])
            {
                dfs(list,w);
            }
    }

    public static void bfs( ArrayList<ArrayList<Integer>> list,int v )
    {
        Queue<Integer> queue = new ArrayDeque<>();
        queue.add(v);
        visited[v]=true;
        while(!queue.isEmpty()){
            int x =queue.poll();
            for(int w :list.get(x))
                if(!visited[w]) {
                    level[w]=level[x]+1;
                    queue.add(w);
                    visited[w]=true;
                }
                s++;
        }
        System.out.println(s);
        s=0;
    }

}

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.StringTokenizer;

public class Main {
	static class Escanner {
		BufferedReader in;
		StringTokenizer st;

		Escanner() throws Throwable {
			in = new BufferedReader(new InputStreamReader(System.in));
			st = new StringTokenizer("");
		}

		int nextInt() throws Throwable {
			if (st.hasMoreTokens())
				return Integer.parseInt(st.nextToken());
			st = new StringTokenizer(in.readLine());
			return nextInt();
		}

		long nextLong() throws Throwable {
			if (st.hasMoreTokens())
				return Long.parseLong(st.nextToken());
			st = new StringTokenizer(in.readLine());
			return nextLong();
		}

		BigInteger nextBigInt() throws Throwable {
			if (st.hasMoreTokens())
				return new BigInteger(st.nextToken());
			st = new StringTokenizer(in.readLine());
			return nextBigInt();
		}

		double nextDouble() throws Throwable {
			if (st.hasMoreTokens())
				return Double.parseDouble(st.nextToken());
			st = new StringTokenizer(in.readLine());
			return nextDouble();
		}

		String nextStr() throws Throwable {
			if (st.hasMoreTokens())
				return st.nextToken();
			st = new StringTokenizer(in.readLine());
			return nextStr();
		}
	}

	public static void main(String[] args) throws Throwable {
		Escanner sc = new Escanner();
		int n = sc.nextInt();
		int k = sc.nextInt();

		int[] list = new int[n];
		for(int i=0; i<n; i++)
			list[i] = sc.nextInt();
		Arrays.sort(list);

		int cnt = 0;
		for(int i=0; i<n; i++){
			if(k<list[i])
				break;
			k-=list[i];
			cnt++;
		}

		System.out.println(cnt);
		for(int i=0; i<cnt; i++)
			System.out.print (list[i]+" ");
	}
}

import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    static Scanner cin = new Scanner(new BufferedInputStream(System.in));
    static PrintWriter cout = new PrintWriter(new BufferedOutputStream(System.out));
    public static void main(String[] args) {
        // TODO Auto-generated method stub
        while (cin.hasNext()){
            int n = cin.nextInt();
            int d = cin.nextInt();
            Pair[] days = new Pair[n];
            for (int i = 0; i < n; i++){
                days[i] = new Pair(cin.nextInt(), i+1);
            }
            Arrays.sort(days);
            int ans = 0;
            for (int i = 0; i < n && d >= 0; i++){
                if (days[i].first <= d){
                    ans = i + 1;
                    d -= days[i].first;
                }
            }
            cout.println(ans);
            for (int i = 0; i < ans; i++){
                cout.print(i+1);
                if (i + 1 == ans){
                    cout.print("\n");
                }else{
                    cout.print(" ");
                }
            }
            cout.flush();
        }
    }
    public static class Pair implements Comparable<Pair>{
        public int first;
        public int second;
        //Pair (){}
        Pair (int first, int second){
            this.first = first;
            this.second = second;
        }
        public int compareTo(Pair rhs) {
            return this.first - rhs.first;
        }
    }
}

/**
 * Created by user on 12/15/2014.
 */
import java.util.
        *;
public class three
{
    public static void main(String[] args)
    {
        Scanner input = new Scanner(System.in);
        int n = input.nextInt();
        int k = input.nextInt();
        int[] arr = new int[n];
        for(int i = 0; i < n; i++)
            arr[i] = input.nextInt();
        Arrays.sort(arr);
        int sum = 0;
        int cnt = 0;
        while(cnt < n && sum + arr[cnt] <= k)
        {
            sum += arr[cnt];
            cnt ++;

        }
        System.out.println(cnt);
        for(int i = 0; i < cnt; i++)
            System.out.println(arr[i]);
    }
}

import java.util.*;
import java.lang.*;

public class qwerty{

	public static void main(String args[]){
	Scanner in = new Scanner(System.in);
	int n = in.nextInt();
	int k = in.nextInt();
	int arr[] = new int[n];
	int arr2[] = new int[n];
	for(int i=0;i<n;i++){
		arr[i]=in.nextInt();
		arr2[i]=arr[i];
	}
	Arrays.sort(arr);
	int cnt=0,j=0;
	while(cnt<=k && j<n){
	cnt+=arr[j];
	j++;
	}
	System.out.println(j);

	int temp=0;
	for(int i=0;i<j;i++){
	temp=arr[i];
		for(k=0;k<n;k++){
		if(arr[2]==temp) {k++;System.out.print(k+" ");arr2[k-1]=-1;}
		}

	}

	}

}

import java.util.Arrays;
import java.util.Scanner;

public class _507_A_AmrAndMusic {
	private static Scanner sc;
	public static void main(String[] args) {
        sc = new Scanner(System.in);
        String[] str = sc.nextLine().split(" ");
        int number_instrument = Integer.parseInt(str[0]);
        int day = Integer.parseInt(str[1]);
        String[] st = sc.nextLine().split(" ");
        int [][] arr = new int[number_instrument][2];
        for(int i=0;i<number_instrument;i++) {
        	arr[i][0]=Integer.parseInt(st[i]);
        	arr[i][1] = i+1;
        }

        Arrays.sort(arr,(a,b)->a[0]==b[0]?Integer.compare(a[1], b[1]):Integer.compare(a[0], b[0]));

        int sum=0;
        int index=0;
        for(int i=0;i<number_instrument;i++) {
        	sum+=arr[i][0];
        	if(sum>day) {
        		index = i;
        		break;
        	}
        	index=i;
        }
        //System.out.println(sum);
        System.out.println(index+1);
        String ans="";
        for(int i=0;i<=index;i++) {
            ans += Integer.toString(arr[i][1])+" ";
        }
        System.out.println(ans.substring(0,ans.length()-1));
	}
}

import java.util.ArrayList;
import java.util.Scanner;
public class JavaApplication39 {
    public static void main(String[] args) {
        int n , k , a;
        ArrayList  list = new ArrayList();
        ArrayList  num = new ArrayList();
        ArrayList  ind = new ArrayList();

        Scanner in = new Scanner(System.in);
        n = in.nextInt();
        k = in.nextInt();
        for (int i = 1; i <= n; i++) {
            a = in.nextInt();
            num.add(a);
            ind.add(i);
        }
        for (int i = 0; i < n; i++) {
            int key = (int) num.get(i);

            if( key <= k && key != 0){
                 k = k - key;
                 list.add(i+1);
            }

        }

        System.out.println(list.size());
        list.sort(null);
        for (int i = 0; i < list.size(); i++) {
            if( i == list.size()-1){
                System.out.println(list.get(i));
                return;
            }
            System.out.print(list.get(i) + " ");
        }
    }

}

import java.util.*;
public class Main
{
	public static void main(String[] args)
	{
		Scanner s = new Scanner (System.in);
		int n=s.nextInt(),k=s.nextInt(),i=0,min,index;
		ArrayList <Integer> list = new ArrayList<Integer>();

		ArrayList <Integer> list2 = new ArrayList<Integer>();

		while (n>0)
		{
			list.add(s.nextInt());

	n--;
		}
		while(k>0) {
		min=Collections.min(list);
		index=list.indexOf(min);
			k-=min;
		if (k >= 0)
		list2.add(index+1);
		list.set(index,1001);

	}
	System.out.println(list2.size());
	for (i=0;i<list2.size();i++)
	System.out.print(list2.get(i)+" ");
	}
}

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;

public class Amar {
  public static void main(String[] args) {
	Scanner sc = new Scanner(System.in);
	int n1 = sc.nextInt();
	int n2 = sc.nextInt();
	int a[] = new int[n1];
	//int b[] = new int[n1];
	ArrayList<Integer> al = new ArrayList<>();
	for(int i=0;i<n1;i++)
	{
	a[i] = sc.nextInt();
	}
	 Arrays.sort(a);
	 int sum=0;
	 int count=0;
	 for(int i=0;i<a.length;i++)
	 {
		 if(sum+a[i]<=n2)
		 {
		 sum = sum + a[i];
		 count++;
		 al.add(i+1);
		 }
	 }
	 System.out.println(count);
	for(Integer i : al)
	{
		System.out.print(i+" ");
	}
}
}

import java.io.FileNotFoundException;
import java.util.NoSuchElementException;
import java.util.Arrays;
import java.util.Scanner;
import java.io.File;
//import java.util.*;
//import java.io.*;

public class HelloWorld {
    public static void main(String[] args) { ////throws FileNotFoundException {
        //int N = System.in();
        //int T = System.in();

        ///System.out.println(new File("test_input.txt.txt").getAbsoluteFile());

        ///*
        Scanner in = new Scanner(System.in);
        ////File file = new File("./resources/test_input.txt"); //./src/test_input.txt");
        ////in = new Scanner(file);

        String A = in.next(); //Integer.parseInt(args[0]);
        int N = Integer.parseInt(A);
        String B = in.next(); //Integer.parseInt(args[1]);
        int T = Integer.parseInt(B);

        int[] instrum = new int[N];

        String C;
        int D;
        for (int i = 0; i < N; i++) {
            C = in.next();
            D = Integer.parseInt(C);
            instrum[i] = D; //Integer.parseInt(args[i+2]);
        }
        //sort by numerical: instrument
        Arrays.sort(instrum);

        String ans = "";
        int count = 0;
        for (int j = 0; j < N; j++) {
            if ((T - instrum[j]) < 0) {
                break;
            } else {
                count++;
                ans += instrum[j] + " ";
                T -= instrum[j];
            }
        }
        System.out.println(count);
        if (ans.length() > 0) {
            System.out.println(ans);
        }
        in.close();
        //*/

    }
}

import java.io.*;
import java.util.*;
public class Amr{
public static void main(String[] args)throws IOException{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
String[] nm=(br.readLine()).split(" ");;
int n=Integer.parseInt(nm[0]);
int m=Integer.parseInt(nm[1]);
String[] val=(br.readLine()).split(" ");
int[] a=new int[n];
for(int i=0;i<n;i++)
	a[i]=Integer.parseInt(val[i]);
Arrays.sort(a);
int x=0;
int days=0;
int[] b=new int[n];
int index=0;
for(int i=0;i<n;i++){
x +=a[i];
if(x <=m){ ++days;b[index++]=i+1;}
else break;

}
System.out.println(days);
if(days==0) return;
for(int i=0;i<days;i++)
	System.out.print(b[i]+" ");

}

}

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

/**
 *
 * @author minaaa
 */
public class A {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here
        Scanner sc = new Scanner(System.in);
        int counter = 0, sum = 0;
        List<Integer> instruments = new ArrayList<>();
        int n = sc.nextInt();
        int days = sc.nextInt();
        for (int i = 0; i < n; i++) {
            instruments.add(sc.nextInt());
        }
        Collections.sort(instruments);
        for (int i = 0; i < n; i++) {
            if (sum + instruments.get(i) <= days) {
                sum =instruments.get(i)+sum;

                counter++;
            }
        }
        System.out.println(counter);
        for (int i = 0; i < counter; i++) {
            System.out.print(instruments.get(i) + " ");
        }
    }

}

import java.io.*;
import java.util.*;

public class Main {
    public static void main(String[] args) {
        PrintWriter stdout = new PrintWriter(new BufferedOutputStream(System.out));
        kernel("stdin", stdout);
    }

    public static void kernel(String source, PrintWriter out) {
        MyScanner sc = new MyScanner(source);

        // Start writing your solution here. -------------------------------------
        /*
          int n      = sc.nextInt();        // read input as integer
          long k     = sc.nextLong();       // read input as long
          double d   = sc.nextDouble();     // read input as double
          String str = sc.next();           // read input as String
          String s   = sc.nextLine();       // read whole line as String
        */
        int n = sc.nextInt();
        int k = sc.nextInt();
        Instrument[] ists = new Instrument[n];

        for (int i=0;i<n;++i) {
            ists[i] = new Instrument();
            ists[i].day = sc.nextInt();
            ists[i].id = i+1;
        }

        Arrays.sort(ists);

        int sum = 0;
        int count = 0;
        for (int i=0;i<n;++i) {
            out.print(ists[i].day + " ");
            sum += ists[i].day;
            if (sum <= k) {
                count += 1;
            }
        }
        out.println();

        if (count == 0) {
            out.println(0);
        } else {
            for (int i=0;i<count;++i) {
                out.print(ists[i].id + " ");
            }
            out.println();
        }

        // Stop writing your solution here. -------------------------------------
        out.close();
    }

    //-----------MyScanner class for faster input----------
    public static class MyScanner {
        BufferedReader br;
        StringTokenizer st;

        public MyScanner(String source) {
            if (source.equals("stdin")) {
                br = new BufferedReader(new InputStreamReader(System.in));
            } else {
                try {
                    br = new BufferedReader(new FileReader(source));
                } catch (Exception e) {
                    System.out.println("Error reading file");
                }
            }
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine(){
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }

    }
    //--------------------------------------------------------
}

class Instrument implements Comparable<Instrument> {

    int day;
    int id;
    @Override
    public int compareTo(Instrument o) {
        return Integer.compare(this.day, o.day);
    }
}

import java.util.*;
import java.io.*;

import javax.swing.text.AbstractDocument.BranchElement;

public class Main {

    public static void main(String[] args) {
        new Main().start();
    }

    void start(){
        Scanner reader = new Scanner(System.in);
        int n ,k;
        int counter =0 , arr[],arr2[];
        boolean hap[];

        while(reader.hasNext()){
            n = reader.nextInt();
            k= reader.nextInt();
            arr = new int[n];
            arr2 = new int[n];
            counter = 0 ;
            hap = new boolean[n];

            for(int i=0 ;i<n ; i++){
                arr[i] = reader.nextInt();
                arr2[i] = arr[i] ;
            }
            Arrays.sort(arr);

            for(int j=0 ; j<n ; j++){
                if(arr[j]>k)
                    break ;

                k= k-arr[j];
                counter++ ;
            }

            System.out.println(counter);
            for(int i=0 ; i<counter ;i++){
                if(i==counter-1){
                    for(int j=0 ; j<n ; j++){
                        if(arr[i]==arr2[j] && hap[j]==false){
                            hap[j] = true ;
                            System.out.println(j+1);

                        }
                    }
                }
                else{
                    for(int j=0 ; j<n ; j++){
                        if(arr[i]==arr2[j] && hap[j]==false){
                            hap[j] = true ;
                            System.out.print((j+1) + " ");

                        }
                    }

                }
            }

        }

    }

}

import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Scanner;
import java.util.TreeMap;

public class Main
{

	public static void main(String[] args)
	{
		Scanner input = new Scanner(System.in);
		HashMap<Integer,Integer> map = new HashMap<Integer,Integer>();
        ValueComparator bvc =  new ValueComparator(map);
        TreeMap<Integer,Integer> sorted_map = new TreeMap<Integer,Integer>(bvc);
		int nrOfInstruments = input.nextInt();
		int days = input.nextInt();
		input.nextLine();
		for(int i = 1; i<=nrOfInstruments; i++)
		{
			map.put(i, input.nextInt());
		}
		input.close();
		sorted_map.putAll(map);
		System.out.println(sorted_map.toString());
		int maximumInstruments = 0;
		int numberOfDays = 0;
		for(Integer instrument : sorted_map.values())
		{
			if((numberOfDays+instrument)<=days)
			{
				numberOfDays+=instrument;
				maximumInstruments++;
			}
		}
		System.out.println(maximumInstruments);
		for(int i = 0; i<maximumInstruments; i++)
		{
			System.out.print(sorted_map.keySet().toArray()[i] + " ");
		}
	}
	static class ValueComparator implements Comparator<Integer> {

	    Map<Integer, Integer> base;
	    public ValueComparator(Map<Integer, Integer> base) {
	        this.base = base;
	    }

	    // Note: this comparator imposes orderings that are inconsistent with equals.
	    public int compare(Integer a, Integer b) {
	        if (base.get(a) <= base.get(b)) {
	            return -1;
	        } else {
	            return 1;
	        } // returning 0 would merge keys
	    }
	}
}

import java.io.*;
import java.util.*;

public class Smile {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out);
		int n = in.nextInt();
		int m = in.nextInt();
		int[] a = new int[n];
		int[] b = new int[n];
		for (int i = 0; i < n; i++) {
			a[i] = in.nextInt();
			b[i] = i + 1;
		}
		for (int i = 0; i < n - 1; i++) {
			for (int j = 0; j < n - 1; j++) {
				if (a[i] > a[i + 1]) {
					int temp = a[i];
					a[i] = a[i + 1];
					a[i + 1] = temp;
					temp = b[i];
					b[i] = b[i + 1];
					b[i + 1] = temp;
				}
			}
		}
		int sum = 0;
		boolean flag = true;
		for (int i = 0; i < n; i++) {
			sum += a[i];
			if (sum > m) {
				flag = false;
				out.println(i);
				break;
			}
		}
		if (flag) {
			out.println(n);
		}
		sum = 0;
		for (int i = 0; i < n; i++) {
			sum += a[i];
			if (sum <= m) {
				out.print(b[i] + " ");
			} else {
				break;
			}
		}

		out.close();
	}
}

import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.Scanner;

public class ProblemA {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        final int[] a = new int[n];
        List<Integer> idx = new ArrayList<Integer>();
        for (int i = 0; i < n; i++) {
            a[i] = sc.nextInt();
            idx.add(i);
        }
        Collections.sort(idx, new Comparator<Integer>() {
            @Override
            public int compare(Integer o1, Integer o2) {
                return Integer.compare(a[o1], a[o2]);
            }
        });
        int sum = 0;
        int i = 0;
        int cnt = 0;
        while (i < a.length && sum + a[idx.get(i)] <= k) {
            i++;
            sum += a[idx.get(i)];
            cnt++;
        }
        System.out.println(cnt);
        for (i = 0; i < cnt; i++) {
            System.out.print((idx.get(i) + 1) + " ");
        }
        System.out.println();
        sc.close();
    }

}

import java.io.*;
import java.util.*;

public class Main {
    public static void main(String[] args) {
        PrintWriter stdout = new PrintWriter(new BufferedOutputStream(System.out));
        kernel("stdin", stdout);
    }

    public static void kernel(String source, PrintWriter out) {
        MyScanner sc = new MyScanner(source);

        // Start writing your solution here. -------------------------------------
        /*
          int n      = sc.nextInt();        // read input as integer
          long k     = sc.nextLong();       // read input as long
          double d   = sc.nextDouble();     // read input as double
          String str = sc.next();           // read input as String
          String s   = sc.nextLine();       // read whole line as String
        */
        int n = sc.nextInt();
        int k = sc.nextInt();
        Instrument[] ists = new Instrument[n];

        for (int i=0;i<n;++i) {
            ists[i] = new Instrument();
            ists[i].day = sc.nextInt();
            ists[i].id = i+1;
        }

        Arrays.sort(ists);

        int sum = 0;
        int count = 0;
        for (int i=0;i<n;++i) {
            sum += ists[i].day;
            if (sum <= k) {
                count += 1;
            }
        }

        if (count == 0) {
            out.println(0);
        } else {
            int[] a = new int[count];
            for (int i=0;i<count;++i) {
                a[i] = ists[i].id;
            }
            Arrays.sort(a);
            for (int i=0;i<count;++i) {
                out.print(a[i] + " ");
            }
            out.println();
        }

        // Stop writing your solution here. -------------------------------------
        out.close();
    }

    //-----------MyScanner class for faster input----------
    public static class MyScanner {
        BufferedReader br;
        StringTokenizer st;

        public MyScanner(String source) {
            if (source.equals("stdin")) {
                br = new BufferedReader(new InputStreamReader(System.in));
            } else {
                try {
                    br = new BufferedReader(new FileReader(source));
                } catch (Exception e) {
                    System.out.println("Error reading file");
                }
            }
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine(){
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }

    }
    //--------------------------------------------------------
}

class Instrument implements Comparable<Instrument> {

    int day;
    int id;
    @Override
    public int compareTo(Instrument o) {
        return Integer.compare(this.day, o.day);
    }
}

import java.util.Arrays;
import java.util.Scanner;

public class AmrAndMusic {

    public static void main(String[] args) {

        long entradaTeclado;
        Scanner teclado = new Scanner(System.in);

        String [] array1 = teclado.nextLine().split(" ");

        String [] array2 = teclado.nextLine().split(" ");

        long n = Long.parseLong(array1[0]);
        long k = Long.parseLong(array1[1]);
        int[]pocision = null;
        long[] p = new long[array2.length];
        long[] pp = new long[array2.length];
        long[] ppp = new long[array2.length];
        long[] pos = new long[array2.length];
        long aux;

        for (int m = 0; m < array2.length; m++) {
            p[m] = Long.parseLong(array2[m]);
            pp[m] = Long.parseLong(array2[m]);
            ppp[m] = Long.parseLong(array2[m]);
        }

        for(int i=0;i<(p.length);i++){
                        int j;
			for( j=i+1 ; j<p.length ; j++){
				if( p[i] > p[j] ){
					aux = (long) p [i];
					p[i]=p[j];
                                        ppp[i]= ppp[j];
					p[j]= aux;
                                        ppp[j]= aux;
				}
			}
	}

        long sumatoria = 0;
        for(int i=0;i<(p.length);i++){
                        sumatoria = sumatoria + (long) p[i];
	}

        if (sumatoria <= k){
            System.out.println(n);

            for(int i=0;i<(p.length);i++){
                        System.out.print(i+1 +" ");
            }

        }else{

            if (k<(long) p [0]){
                System.out.println(0);
            }else{

            int a =0;
            long sumadias = 0;

            while (sumadias<k){

            a = a+1;
            sumadias = sumadias + (long) p [a]+1;
            }

                System.out.println(a);

        for(int i=0;i<(pp.length);i++){
        long iPosicion = 0;

        for (int x=0;x<pp.length;x++){
            if (pp[x]==ppp[i]){

            iPosicion = x;
            pos [i] = iPosicion;
            ppp[i]=0;
            pp[x]=0;
        }
        }
        }

                for (int m = 0; m < a; m++) {
                System.out.print(pos[m] +1+ " ");
                }
            }
	}

}
}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskA solver = new TaskA();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskA {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int n = in.nextInt();
            int k = in.nextInt();
            int[] a = new int[n];
            for (int i = 0; i < n; ++i) {
                a[i] = in.nextInt();
            }
            Arrays.sort(a);
            int count = 0;
            int res = 0;
            for (int i = 0; i < n; ++i) {
                count += a[i];
                if (count > k) break;
                ++res;
            }
            out.println(res);
            for (int i = 0; i < res; ++i) {
                out.print((i + 1) + " ");
            }
        }

    }
}

import java.util.Arrays;
import java.util.Scanner;

/**
 * Created by nursultan on 8/12/15.
 */
public class Test48 {

    static void define(int[] a, int days) {

        int m = 0;

        int cnt = 0;

        String indces = "";
        int[] b = a.clone();
        Arrays.sort(a);

        for (int i = 0; i < a.length; i++) {
            if (cnt + a[i] <= days) {
                cnt += a[i];
                m++;
            }
        }

        // obhod
        for (int i = 0; i < m; i++) {
            for (int j = 0; j < b.length; j++) {
                if (a[i] == b[j]) {
                    indces = indces + (j + 1) + " ";
                    b[j] = -1;
                }
            }
        }
        System.out.println(m);
        System.out.println(indces);

    }

    public static void main(String[] args) {

        Scanner in = new Scanner(System.in);

        int n = in.nextInt();
        int d = in.nextInt();
        int[] a = new int[n];

        for (int i = 0; i < n; i++) {
            a[i] = in.nextInt();
        }

        define(a, d);

    }

}

import java.util.Scanner;
import java.util.*;
public class ass {

    public static void main(String args[]) {
        Scanner in = new Scanner(System.in);
        int f=in.nextInt();
        int n=in.nextInt();
        int sum=0;
        int t[]=new int [f];
        for(int i=0;i<f;i++){
            t[i]=in.nextInt();

        }
        Arrays.sort(t);
        for(int i=0;i<f;i++){
            if(n>=sum+t[i]){
                System.out.print(t[i]+" ");
                sum+=t[i];
            }
        }
        if(sum==0)
            System.out.print(0);
        }}

import java.util.Scanner;
public class Test {
	public static void main(String args[]){
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		int sum=0;
		int[] arr=new int[n];
		int k=sc.nextInt();
		for(int i=0;i<n;i++){
			arr[i]=sc.nextInt();
		}
		for(int i=0;i<n;i++){
			for(int j=0;j<n-i-1;j++){
				if(arr[j]>arr[j+1]){
					int temp=arr[j];
					arr[j]=arr[j+1];
					arr[j+1]=temp;
				}
			}
		}
		int i=0;
		for( i=0;i<n&&sum<k;i++){
			sum=sum+arr[i];
			if(sum>k){
				sum-=arr[i];
				break;
			}
		}
		i--;
		System.out.println((i+1));
		for(int j=0;j<=i;j++){
			System.out.print(j+" ");
		}
	}
}

import java.io.*;
import java.util.*;
import java.lang.*;
import java.math.*;
import java.text.*;
import java.util.regex.*;
public final class Main{
	static StringTokenizer st;
	static PrintWriter pw = new PrintWriter(System.out,true);
	static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	private static String next()throws Exception{
		if(st == null || !st.hasMoreTokens()){
			st = new StringTokenizer(br.readLine()," ");
		}
		return st.nextToken();
	}
	private static char nc()throws Exception{
		return next().charAt(0);
	}
	private static int ni()throws Exception{
		return Integer.parseInt(next());
	}
	private static long nl()throws Exception{
		return Long.parseLong(next());
	}
	private static float nf()throws Exception{
		return Float.parseFloat(next());
	}
	private static double nd()throws Exception{
		return Double.parseDouble(next());
	}
	private static String ns()throws Exception{
		return br.readLine();
	}
	private static int[] nia(int n)throws Exception{
		int[] arr = new int[n];
		for(int i=0;i<n;i++){
			arr[i] = ni();
		}
		return arr;
	}
	private static long[] nla(int n)throws Exception{
		long[] arr = new long[n];
		for(int i=0;i<n;i++){
			arr[i] = nl();
		}
		return arr;
	}
	private static long max(long a,long b){
		return Math.max(a,b);
	}
	private static double max(double a,double b){
		return Math.max(a,b);
	}
	private static long min(long a,long b){
		return Math.min(a,b);
	}
	private static double min(double a,double b){
		return Math.min(a,b);
	}
	private static long abs(long a){
		return Math.abs(a);
	}
	private static double abs(double a){
		return Math.abs(a);
	}
	private static void sort(int[] arr){
		Arrays.sort(arr);
	}
	private static void sort(long[] arr){
		Arrays.sort(arr);
	}
	//-------------------------------------------------------------------------------------------------------------//
	//-------------------------------------------------------------------------------------------------------------//
	public static void main(String[] args)throws Exception{
		new Main().timer();
	}
	private static void timer()throws Exception{
		long S = System.currentTimeMillis();
		solve();
		long E = System.currentTimeMillis();
		//pw.println("Time elapsed : "+(E-S)+" ms.");
	}
	private static void solve()throws Exception{
		int T=1;
		//int T=ni();
		for(int I=1;I<=T;I++){
			//code from here....
			int n = ni();
			int k = ni();
			int[] arr = nia(n);
			int[] arrc = new int[n];
			System.arraycopy(arr,0,arrc,0,n);
			sort(arrc);
			int sum = 0;
			ArrayList<Integer> list = new ArrayList<Integer>();
			for(int i=0;i<n;i++){
				if((sum + arrc[i]) <= k){
					list.add(arrc[i]);
					sum += arrc[i];
				}
			}
			if(list.size()==0){
				pw.println(0);
				return;
			}
			StringBuilder out = new StringBuilder("");
			HashSet<Integer> set = new HashSet<Integer>();
			for(int i=0;i<list.size();i++){
				int key = list.get(i);
				for(int j=0;j<n;j++){
					if(arr[j]==key && !set.contains(j)){
						out.append((j+1)+" ");
						set.add(j);
					}
				}
			}
			pw.println(list.size());
			pw.println(out);
		}
	}
}

import java.io.BufferedReader;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.StringTokenizer;

public class A43 {
    public static void main(String [] args) {
        InputStream inputReader = System.in;
        OutputStream outputReader = System.out;
        InputReader in = new InputReader(inputReader);
        PrintWriter out = new PrintWriter(outputReader);
        Algorithm solver = new Algorithm();
        solver.solve(in, out);
        out.close();
    }
}

class Algorithm {
    void solve(InputReader ir, PrintWriter pw) {
        int n = ir.nextInt();
        int k = ir.nextInt();
        int [] a = new int[n];
        int [] b;

        for (int i = 0; i < n; i++) a[i] = ir.nextInt();
        b = a;
        sort(b, 0, n - 1);

        int ans = 0, next = 0, index = 0;
        for (int i = 0; i < n; i++) {
            next = next + b[i];
            if (next > k) {
                break;
            }
            ans++;
            index = i;
        }
        pw.print(ans);
        if (ans != 0) {
            for (int i = 0; i <= index; i++) {
                for (int j = 0; j < n; j++) {
                    if (b[i] == a[j]) {
                        pw.print((j + 1) + " ");
                        a[j] = -1;
                        break;
                    }
                }
            }
        }

    }
    private static void sort(int[] array, int low, int high) {

        int i = low;
        int j = high;
        int x = array[low + (high - low) / 2];

        do {
            while (array[i] < x) ++i;
            while (array[j] > x) --j;
            if (i <= j) {
                int tmp = array[i];
                array[i] = array[j];
                array[j] = tmp;
                i++;
                j--;
            }
        } while (i <= j);

        if (low < j) sort(array, low, j);
        if (i < high) sort(array, i, high);

    }
}

class InputReader {
    private BufferedReader reader;
    private StringTokenizer tokenizer;

    InputReader(InputStream stream) {
        reader = new BufferedReader(new InputStreamReader(stream), 32768);
        tokenizer = null;
    }

    String next() {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(reader.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken();
    }

    int nextInt() {
        return Integer.parseInt(next());
    }

}

import java.util.*;
import java.util.Arrays;

public class FirstCode
{

     public static void main(String [] args) {
    	Scanner sc=new Scanner(System.in);
    	int n=sc.nextInt();
    	int k=sc.nextInt();
    	int i,sum=0,c=0,j,temp;
    	int []a=new int[n];
    	int []b=new int[n];
    	int []d=new int[n];
    	for(i=0;i<n;i++)
    	{
    	a[i]=sc.nextInt();
    	d[i]=i;
    	}
    	for(i=0;i<n-1;i++)
    	{
    		for(j=0;j<n-1;j++)
    		{
    			if(a[j+1]<a[j])
    			{
    				temp=a[j];
    				a[j]=a[j+1];
    				a[j+1]=temp;

    				temp=d[j];
    				d[j]=d[j+1];
    				d[j+1]=temp;

    			}

    		}
    	}
    	for(i=0;i<n;i++)
    	{
    		sum=sum+a[i];
    		c++;
    		if(sum==k)
    			break;
    		else if(sum>k)
    		{

    		sum=sum-a[i];
    	     c--;
    	     continue;
    		}
    		b[c-1]=d[i];

    		}
    	System.out.println(c);
    	for(i=0;i<c;i++)
    		System.out.print((b[i]+1)+" ");

     }}

import java.util.*;
public class a507
{
	public static void main(String ar[])
	{
		Scanner ob=new Scanner(System.in);
		int n=ob.nextInt();
		int k=ob.nextInt();
		int arr[]=new int[n];
		for(int i=0;i<n;i++)
		{
			arr[i]=ob.nextInt();
		}
		Arrays.sort(arr);
		int ans=0,x=0;
		for(int i=0;i<n;i++)
		{
			ans=ans+arr[i];
			x=x+1;
			if(ans>k)
			{
				System.out.println(x-1);
				break;
			}
			else if(ans==k)
			{
				System.out.println(x);
				break;
			}
		}
	}
}

import java.util.Scanner;
public class A {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);

        int n = in.nextInt();
        int k = in.nextInt();
        int arr[] = new int[n];
        int arr2[] = new int[n];
        int sum = 0;
        int min = 100000;

        for(int i=0;i<n;i++){
             arr[i]= in.nextInt();
             arr2[i] = arr[i];
        }

        for(int i=0;i<n;i++){
            for(int j=n-1;j>i;j--){
              if(arr[j] < arr[i]){
                  int temp = arr[i];
                arr[i] = arr[j];
                arr[j] = temp;
              }
           }
        }

        int i;
        int count = 0;
        for(i=0;i<n;i++){

            sum += arr[i];
              count++;
            if(sum > k)
                break;
        }
        System.out.println(count-1);
        if(count != 0){
        for(int j = 0;j<i;j++){
            for(int c=0;c<n;c++){
                if(arr2[c] != 0){
                if(arr[j] == arr2[c]){
                 System.out.print(c+1 + " ");
                arr2[c] = 0;
                }
                }
            }
        }
        }

    }

}

import java.util.ArrayList;
import java.util.Scanner;
import java.util.TreeMap;
import java.util.Map.Entry;

public class A {

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);

		int n = scan.nextInt();
		int k = scan.nextInt();

		TreeMap<Integer,ArrayList<Integer>> map = new TreeMap<Integer,ArrayList<Integer>>();

		for (int i = 0; i<n; i++) {
			int x = scan.nextInt();
			if (!map.containsKey(x))
				map.put(x, new ArrayList<Integer>());
			map.get(x).add(i);
		}

		int c = 0;
		ArrayList<Integer> use = new ArrayList<Integer>();
		main:
		for (Entry<Integer, ArrayList<Integer>> e : map.entrySet()) {
			int t = e.getKey();
			ArrayList<Integer> ind = e.getValue();
			for (int i = 0; i<ind.size(); i++) {
				if (t > k) {
					break main;
				} else {
					c++;
					k -= t;
					use.add(ind.get(i));
				}
			}
		}

		System.out.println(c);
		for (int i = 0; i<use.size(); i++) {
			System.out.print(use.get(i) + " ");
		}

		scan.close();
	}

}

import java.util.Arrays;
import java.util.Scanner;

public class Main {
	private static Scanner reader = new Scanner(System.in);

	public static void main(String[] args) {
		int n = reader.nextInt(),k = reader.nextInt(),sum=0,i;
		int[] tab = new int[n];

		for (i = 0; i < n; i++) {
			tab[i] = reader.nextInt();
		}
		String line=Arrays.toString(tab);
		line=line.substring(1,line.length()-1).replace(",","").replace(" ","");
		Arrays.sort(tab);

		for(i=0;i<n;i++){
			sum+=tab[i];
			if(sum>k){
				break;
			}
		}
		System.out.println(i);
		if(i==n){
			for(i=0;i<n;i++){
				int index=line.indexOf(String.valueOf(tab[i]));
				System.out.print((index+1)+" ");
				line=line.replaceFirst(line.charAt(index)+""," ");
			}
		}else if(i>0){
			for(int j=0;j<i;j++){
				int index=line.indexOf(String.valueOf(tab[j]));
				System.out.print((index+1)+" ");
				line=line.replaceFirst(line.charAt(index)+""," ");
			}
		}
	}
}

import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;

public class Main {
    FastScanner in = new FastScanner();
    PrintWriter out;

    private class Instr {
        public int n;
        public int a;
    }

    public void solve() throws IOException {
        int N = in.nextInt();
        int K = in.nextInt();

        Instr instrs[] = new Instr[N];

        for (int n = 0; n < N; n++) {
            Instr instr = new Instr();
            instr.n = n;
            instr.a = in.nextInt();
            instrs[n] = instr;
        }

        Arrays.sort(instrs, new Comparator<Instr>() {
            public int compare(Instr a, Instr b) {
                return Integer.compare(a.a, b.a);
            }
        });

        int sum = 0;
        for (int n = 0; n < N; n++) {
            sum += instrs[n].a;
            if (sum > K) {
                break;
            }

            System.out.print((instrs[n].n + 1) + " ");
        }

        System.out.println();

    }

    public void run() {
        try {
            solve();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    class FastScanner {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st;

        String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        int read() throws IOException {
            return br.read();
        }
    }

    // http://stackoverflow.com/questions/521171/a-java-collection-of-value-pairs-tuples
    public class Pair<L,R> {

      private final L left;
      private final R right;

      public Pair(L left, R right) {
        this.left = left;
        this.right = right;
    }

    public L getLeft() { return left; }
    public R getRight() { return right; }

    @Override
    public int hashCode() { return left.hashCode() ^ right.hashCode(); }

    @Override
    public boolean equals(Object o) {
        if (o == null) return false;
        if (!(o instanceof Pair)) return false;
        Pair pairo = (Pair) o;
        return this.left.equals(pairo.getLeft()) &&
        this.right.equals(pairo.getRight());
    }

}

public static void main(String[] arg) {
    new Main().run();
}
}

import java.util.Scanner;
import java.util.*;
public class ass {

    public static void main(String args[]) {
        Scanner in = new Scanner(System.in);
        int f=in.nextInt();
        int n=in.nextInt();
        int sum1=0;
        int sum=0;
        int t[]=new int [f];
        for(int i=0;i<f;i++){
            t[i]=in.nextInt();

        }
        Arrays.sort(t);
        for(int i=0;i<f;i++){
            if(n>=sum+t[i]){
                sum+=t[i];
                sum1++;}
        }
       System.out.println(sum1);
        for(int i=0;i<sum1;i++){
                System.out.print(t[i]+" ");

        }
        }}

import java.util.*;
import java.lang.*;

public class qwerty{

	public static void main(String args[]){
	Scanner in = new Scanner(System.in);
	int n = in.nextInt();
	int k = in.nextInt();
	int arr[] = new int[n];
	int arr2[] = new int[n];
	for(int i=0;i<n;i++){
		arr[i]=in.nextInt();
		arr2[i]=arr[i];
	}
	Arrays.sort(arr);
	int cnt=0,j=0;
	while(cnt<=k && j<n){
	cnt+=arr[j];
	j++;
	}
	if(cnt>k) j--;
	System.out.println(j);

	int temp=0;
	for(int i=0;i<j;i++){
	temp=arr[i];
		for(k=0;k<n;k++){
		if(arr2[k]==temp) {k++;System.out.print(k+" ");arr2[k-1]=-1;}
		}

	}

	}

}

import java.math.BigInteger;
import java.util.Arrays;
import java.util.Scanner;

public class Main {

    public static void main(String[] abdou) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt(),
            k = in.nextInt(),
            sum = 0,
            nn = n;

        int [] a = new int[n];
        int [] b = new int[n];
        for(int i = 0; i < n;i++){
        a[i] = in.nextInt();
                sum += a[i];
        }
        Arrays.sort(a);
        for(int i = n-1; i >-1; i--){
        if(sum > k){sum -= a[i];
        b[i] = 1;
        nn--;
        }else break;
        }
        System.out.println(nn);
        for(int i = 0; i < n;i++){
        if(b[i] == 1)break;
        System.out.print(a[i] + " ");
        }

    }

}

import java.util.Arrays;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int k = scan.nextInt();
		int[] array = new int[n];
		int[] x = new int[n];
		for (int i = 0; i < n; i++) {
			array[i] = scan.nextInt();
			x[i] = array[i];
		}
		scan.close();

		Arrays.sort(x);
		int count = 0;
		int total = 0;
		for (int i = 0; i < n; i++) {
			count += x[i];
			if (count <= k) {
				total++;
			}
		}

		System.out.println(total);
		for (int i = 0; i < total; i++) {

			for (int j = 0; j < n; j++) {
				if (x[i] == array[j]) {
					System.out.print(j + 1+" ");
					array[j] = -1;
				}
			}

		}

		System.out.println();

	}

}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.StringTokenizer;

public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskC solver = new TaskC();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskC {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
        	int n = in.nextInt();
        	int timeLeft = in.nextInt();
        	ArrayList<Integer> days = new ArrayList<>();
        	ArrayList<Integer> indices[] = new ArrayList[101];
        	for (int i=0;i<101;i++){
        		indices[i] = new ArrayList<>();
        	}
        	for (int i=0;i<n;i++){
        		int a = in.nextInt();
        		days.add(a);
        		indices[a].add(i+1);
        	}
        	Collections.sort(days);
        	int numOfInstruments = 0;
        	while(timeLeft>0 && numOfInstruments<days.size()){
        		timeLeft -= days.get(numOfInstruments);
        		if (timeLeft>=0){
        			numOfInstruments++;
        		} else
        			break;
        	}
        	out.println(numOfInstruments);
        	for (int j=0;j<101;j++){
    			for (int i=0;i<indices[j].size();i++){
    				if (numOfInstruments>0){
    					numOfInstruments--;
    					out.print((indices[j].get(i) + 1) + " ");
    				} else
    					break;
    			}
        	}
        }
    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}

import java.util.Arrays;
import java.util.Scanner;

public class Problem1 {
    public static class node implements Comparable<node>{
        int index;
        int num;

        public node( int index, int num){
            this.index=index;
            this.num=num;
        }
        @Override
        public int compareTo(node o) {
            // TODO Auto-generated method stub
            return num-o.num;
        }
    }

    public static void main(String[] args) {
        // TODO Auto-generated method stub
        Scanner scan=new Scanner(System.in);
        int n= scan.nextInt();
        int k= scan.nextInt();
        node[] ar = new node[n];
        for(int i=0; i<n; i++){
            int a =scan.nextInt();
            ar[i]= new node(i+1,a);
        }
        Arrays.sort(ar);
        int i=0;
        int sum=k;
        for(int j=0; j<n; j++){
            if( sum- ar[j].num >=0){
                i++;
            }
        }
        System.out.println(i);
        for(int j=0; j<i; j++) System.out.print( ar[j].index + " " );
    }
}

import java.util.Scanner;

public class Solution
{
    public static void main(String arg[])
    {
         Scanner sc=new Scanner(System.in);
        int n,k,i,j,sum=0,no_of_ins=0;
        n=sc.nextInt();
        k=sc.nextInt();
        int time[]=new int[n];
        int index[]=new int[n];
        for(i=0;i<n;i++)
        {
            time[i]=sc.nextInt();
            index[i]=i;
        }
        //sort both the array in asc

        for(i=0;i<n;i++)
        {
            for(j=0;j<n;j++)
            {
                if(time[i]<time[j])
                {
                    //swap
                    int temp=time[i];
                    time[i]=time[j];
                    time[j]=temp;

                    int tempInd=index[i];
                    index[i]=index[j];
                    index[j]=tempInd;
                }
            }
        }
        for(i=0;i<n;i++)
        {
            sum=sum+time[i];

            if(sum>k)
            {
                break;
            }
            else
            {

                no_of_ins=no_of_ins+1;
            }
        }
        //System.out.println(sum);
        System.out.println(no_of_ins);
        for(i=0;i<no_of_ins;i++)
        {
            System.out.print(index[i] +" ");
        }

    }

}

import java.util.*;
public class ArmnMusic {

	public static void main(String[] args)
	{
       Scanner sc=new Scanner(System.in);
       int n=sc.nextInt();
       int k=sc.nextInt();
       int arr[]=new int[n];
       int arr1[]=new int[n];
       for(int i=0;i<n;i++)
       {
    	   arr[i]=sc.nextInt();
    	   arr1[i]=arr[i];
       }
       Arrays.sort(arr);
       int sum=0;
       int count=0;
     for(int j=0;j<n;j++){

    	 if(sum<=k&&k>=sum+arr[j])
    	 { sum=sum+arr[j];
    	 count ++;}
    	 else break;

     }System.out.println(count);

	for(int i=0;i<count;i++)
	{
		System.out.print(arr1[i]+" ");
	}
	}

}

import java.util.Arrays;
import java.util.Scanner;

public class AmrAndMusic {

    public static void main(String[] args) {

        long entradaTeclado;
        Scanner teclado = new Scanner(System.in);

        String [] array1 = teclado.nextLine().split(" ");

        String [] array2 = teclado.nextLine().split(" ");

        long n = Long.parseLong(array1[0]);
        long k = Long.parseLong(array1[1]);
        long[] p = new long[array2.length];
        long[] ppp = new long[array2.length];
        long aux;

        for (int m = 0; m < array2.length; m++) {
            p[m] = Long.parseLong(array2[m]);
            ppp[m] = m+1;
        }

        for(int i=0;i<(p.length);i++){
                        int j;
			for( j=i+1 ; j<p.length ; j++){
				if( p[i] > p[j] ){
					aux = (long) p [i];
					p[i]=p[j];
                                        ppp[i]= ppp[j];
					p[j]= aux;
                                        ppp[j]= aux;
				}
			}
	}

        long sumatoria = 0;
        for(int i=0;i<(p.length);i++){
                        sumatoria = sumatoria + (long) p[i];
	}

        if (sumatoria <= k){
            System.out.println(n);

            for(int i=0;i<(p.length);i++){
                        System.out.print(i+1 +" ");
            }

        }else{

            if (k<(long) p [0]){
                System.out.println(0);
            }else{

            int a =0;
            int sumadias = 0;

            while (sumadias<k){

            sumadias = sumadias +(int) p [a];
            a = a+1;
            }

                if (sumadias==k){
                    System.out.println(a);

                    for (int m = 0; m < a; m++) {
                    System.out.print(ppp[m] + " ");
                }
                }else{
                System.out.println(a-1);

                for (int m = 0; m < a-1; m++) {
                System.out.print(ppp[m] + " ");
                }
            }}
	}

}
}

/**
 * Created by Marcos on 31/12/2016.
 */

import java.io.*;
import java.util.Arrays;
import java.util.Comparator;
import java.util.Scanner;
import java.util.StringTokenizer;

public class dfsa implements Comparable<dfsa> {
    private int p,i;
    public dfsa(int p,int i){
        this.p=p;
        this.i=i;
    }
    public int compareTo(dfsa o){
        return this.p-o.p;
    }

    public static void main(String[] args) {
        InputReader in = new InputReader(System.in);
        int n=in.nextInt();
        int k=in.nextInt();
        dfsa[] a = new dfsa[n];
        for(int i=0; i<n; i++)
        {
            a[i]=new dfsa(in.nextInt(), i+1);
        }
        Arrays.sort(a);
        int indice=0;
        int sum=0;
        for(int i=0; i<a.length; i++){
            sum+=a[i].p;
            if(sum<=k){
                indice=i;
            }else
                break;
        }

        if(indice==0){
            System.out.println(0);
        }else{
            System.out.println(indice+1);
            for(int i =0; i<=indice;i++){
                System.out.print(a[i].i + " ");
            }
        }

        }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}

import java.util.Scanner;
import java.util.*;
public class ass {

    public static void main(String args[]) {
        Scanner in = new Scanner(System.in);
        int f=in.nextInt();
        int n=in.nextInt();
        int sum1=0;
        int sum=0;
        int t[]=new int [f];
        int m[]=new int [f];
        for(int i=0;i<f;i++){
            t[i]=in.nextInt();
             m[i]=t[i];
        }
        Arrays.sort(m);
        for(int i=0;i<f;i++){
            if(n>=sum+m[i]){
                sum+=m[i];
                sum1++;}
        }
        System.out.println(sum1);
        for(int j=0;j<sum1;j++){
        for(int i=0;i<f;i++){
            if(m[j]==t[i]){
                System.out.print(i+1+" ");
                t[i]=n;}
            }}}
        }

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.StringTokenizer;

public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskC solver = new TaskC();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskC {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
        	int n = in.nextInt();
        	int timeLeft = in.nextInt();
        	int x = 0;
        	ArrayList<Integer> indices[] = new ArrayList[101];
        	ArrayList<Integer> days = new ArrayList<>();
        	for (int i=1;i<101;i++){
        		indices[i] = new ArrayList<>();
        	}
        	for (int i=1;i<n+1;i++){
        		int a = in.nextInt();
        		days.add(a);
        		indices[a].add(i);
        	}
        	Collections.sort(days);
        	int ans = 0;
        	while (timeLeft>0){
        		timeLeft -= days.get(ans);
        		if (timeLeft>=0)
        			ans++;
        	}
        	out.println(ans);
        	for (int i=1;i<n+1;i++){
        		if (indices[i].size()>0 && ans>0){
        			for (int j=0;j<indices[i].size();j++){
            			if (ans>0){
            				out.print(indices[i].get(j) + " ");
            				ans--;
            			} else
            				break;
            		}
        		}
        	}
        }
    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}

import java.util.Arrays;
import java.util.Scanner;

public class lab507a {
    public static void main(String args[]) {
        Scanner in = new Scanner(System.in);
        int n=in.nextInt();
        int k=in.nextInt();
        int d=0;
        int[] a=new int[n];
        int[] b=new int[n];
        for (int i=0;i<n;i++){
            a[i]=in.nextInt();
        }
        int[] c = new int[n];
        System.arraycopy(a, 0, c, 0, n);
        Arrays.sort(a);
        int j=0;
        if(a[0]>k){
            System.out.print(0);
        }else {
            while (k > 0) {

                for (int i = 0; i < n; i++) {
                    if ((c[i] == a[j]) && (c[i] > 0)) {
                        b[j] = i + 1;
                        c[i] = 0;
                        break;
                    }
                }
                d++;
                k = k - a[j];
                if((k-a[j])<=0)break;
                j++;

            }
            System.out.println(d);
            for (int i=0;i<n;i++){            if(b[i]==0)break;

                System.out.print(b[i]+" ");
            }
        }

    }
}

import java.io.*;
import java.util.*;

public class Main {

    public static void main(String[] args) throws IOException {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        InputReader.OutputWriter out = new InputReader.OutputWriter(outputStream);

        int n = in.nextInt();
        int k = in.nextInt();
        int [] a = new int[n];
        for (int i = 0; i < a.length; i++) {
            a[i] = in.nextInt();
        }
        Arrays.sort(a);
        int sum = 0;
        int index = -1;
        for (int i = 0; i < a.length; i++) {
            if(sum+a[i]<=k) {
                sum+=a[i];
                index = i;
            }
            else break;
        }
        out.println(index + 1);
        for (int i = 0; i <=index; i++) {
            out.print(a[i] + " ");
        }
        out.flush();
    }
    static boolean isPalindrome(char [] c) {
        int i = 0;
        int j = c.length - 1;
        while (i<=j) {
            if(c[i]!=c[j]) return false;
            i++;
            j--;
        }
        return true;
    }
    static boolean isPrime(long n) {
        for (long i = 2; i*i<=n; i++) {
            if(n%i==0) return false;
        }
        return  true;
    }
    static void  reverse(int [] a, int i,int j) {
        while (i<=j) {
            int temp = a[i];
            a[i] = a[j];
            a[j] = temp;;
            i++;
            j--;
        }
    }
    static int gcd(int a,int b) {
        return b == 0 ? a : gcd(b,a%b);
    }
}

class InputReader extends BufferedReader {
    StringTokenizer tokenizer;

    public InputReader(InputStream inputStream) {
        super(new InputStreamReader(inputStream), 32768);
    }

    public InputReader(String filename) {
        super(new InputStreamReader(Thread.currentThread().getContextClassLoader().getResourceAsStream(filename)));
    }

    public String next() {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(readLine());
            } catch (IOException e) {
                throw new RuntimeException();
            }
        }
        return tokenizer.nextToken();
    }

    public Integer nextInt() {
        return Integer.valueOf(next());
    }
    public Long nextLong() {return  Long.valueOf(next());}

    static class OutputWriter extends PrintWriter {
        public OutputWriter(OutputStream outputStream) {
            super(outputStream);
        }

        public OutputWriter(Writer writer) {
            super(writer);
        }

        public OutputWriter(String filename) throws FileNotFoundException {
            super(filename);
        }

        public void close() {
            super.close();
        }
    }
}

import java.util.*;
import java.io.*;

public class Solution{

	public static void main(String [] args) throws IOException{

		Queue<Integer> q = new LinkedList<Integer>();

		int count = 0;

		Scanner s = new Scanner(System.in);

		int n = s.nextInt();
		int k = s.nextInt();

		int [] A = new int[n];

		int [] index = new int[n+1];

		for(int i=0;i<n;i++){
			A[i] = s.nextInt();
			index[A[i]] = i+1;
		}

		Arrays.sort(A);

		for(int i: A){
			if(k-i>=0){
				q.add(index[i]);
				k-=i;
				count++;

			}
			else
				break;

		}

		System.out.println(count);

		while(!q.isEmpty())
			System.out.print(q.remove() + " ");

	}
}

import java.util.Scanner;
public class Test {
	public static void main(String args[]){
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		int sum=0;
		int[] arr=new int[n];
		int k=sc.nextInt();
		for(int i=0;i<n;i++){
			arr[i]=sc.nextInt();
		}
		for(int i=0;i<n;i++){
			for(int j=0;j<n-i-1;j++){
				if(arr[j]>arr[j+1]){
					int temp=arr[j];
					arr[j]=arr[j+1];
					arr[j+1]=temp;
				}
			}
		}
		int i=0;
		for( i=0;i<n&&sum<k;i++){
			sum=sum+arr[i];
			if(sum>k){
				sum-=arr[i];
				break;
			}
		}
		i--;
		System.out.println((i+1));
		for(int j=0;j<=i;j++){
			System.out.print((j+1)+" ");
		}
	}
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.StringTokenizer;

public class Main {
	private void solve() throws IOException{
		InputStreamReader isr = new InputStreamReader(System.in);
		BufferedReader br = new BufferedReader(isr);
		StringTokenizer st = new StringTokenizer(br.readLine(), " ");

		int n = Integer.parseInt(st.nextToken());
		int sum = Integer.parseInt(st.nextToken());
		int[] a  = new int[n];

		st = new StringTokenizer(br.readLine()," ");
		for(int i = 0; i < n; i++) a[i] = Integer.parseInt(st.nextToken());

		ArrayList <Integer> al = new ArrayList<Integer>();
		int maxCount = 0;
		int k = (int) Math.pow(2, n)-1;
		for(int i =  k; i > 0; i--){
			int t = i;
			int jBit = 0;
			int tempSum = 0;
			while(t > 0){
				if((t & 1) == 1){
					tempSum += a[jBit];
				}
				jBit++;
				t = t >> 1;
			}
			if((tempSum < sum) && (i == k)){
				break;
			}else if((tempSum == sum) && jBit > maxCount){
				maxCount = jBit;
				t = i;
				jBit = 0;
				while(t > 0){
					if((t & 1) == 1){
						al.add(jBit+1);
					}
					jBit++;
					t = t >> 1;
				}
				break;
			}
		}
		System.out.println(al.size());
		for(int x: al) System.out.print(x+" ");
	}
	public static void main(String[] args) throws IOException{
		Main m = new Main();
		m.solve();
	}
}

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author Porya
 */
import java.util.*;
public class AmrAndMusic {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        int k=sc.nextInt();

        ArrayList<Integer> a=new ArrayList<>();
        ArrayList<Integer> b=new ArrayList<>();
        for (int i = 0; i < n; i++) {
            a.add(sc.nextInt());
        }

        int min=101;
        int mini = 0;
        int m=0;
        do
        {
            for (int i = 0; i < n; i++) {
                if(a.get(i)<min && a.get(i)!=-1)
                {
                    min=a.get(i);
                    mini=i;

                }
            }

         if(k-min>=0)
            {

                a.remove(mini);
                a.add(mini, -1);
                //System.out.println(a);

                b.add(mini+1);
                k-=min;
                min=101;
                m++;
            }
         else
             break;
        }while(k>0);

        System.out.println(m);
        b.sort(null);
        if(b.size()!=0)
        {
            System.out.print(b.get(0));
            for (int i = 1; i < b.size(); i++) {
                System.out.print(" "+b.get(i));

            }
        }

    }

}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;
import java.util.TreeSet;

public class A_Div2_287 {
    public static void main(String[]arg) throws IOException
    {
        new A_Div2_287().solve();
    }
    public void solve() throws IOException
    {
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st =  new StringTokenizer(in.readLine());
        int n = Integer.parseInt(st.nextToken());
        int k = Integer.parseInt(st.nextToken());
        TreeSet<Integer> tree = new TreeSet<Integer>();
        st = new StringTokenizer(in.readLine());
        for(int i = 0; i < n; i++)
        {
            tree.add(Integer.parseInt(st.nextToken()));
        }
        boolean next = true;
        int i = 0;
        int ins = 0;
        String ans = "";
        while(next && i < tree.size())
        {
            int v = tree.pollFirst();
            int minus = k - v;
            if(minus >= 0)
            {
                k -= v;
                ins++;
                ans += v + " ";
                i++;
            }
            else
            {
                next = false;
            }
        }
        System.out.println(ins);
        if(!ans.isEmpty())
            System.out.println(ans.trim());
    }
}

import java.util.*;
public class Solution {

	public static void merge(int [] arr1 ,int[] arr2 , int s , int e) {
		int i = s;
		int m = (s + e)/2 + 1;
		int j = m;
		int k = 0;
		int si = e - s + 1;
		int[] n = new int[si];
		int[] n2 = new int[si];
		while(k < si) {
			if(i >= m) {
				n[k] = arr1[j];
				n2[k] = arr2[j];
				j++;
			}else if(j > e) {
				n[k] = arr1[i];
				n2[k] = arr2[i];
				i++;
			}else {
				if(arr1[i] <= arr1[j]) {
					n[k] = arr1[i];
					n2[k] = arr2[i];
					i++;
				}else {
					n[k] = arr1[j];
					n2[k] = arr2[j];
					j++;
				}
			}
			k++;
		}
		int y = s;
		for(int o = 0 ; o < si ; o++) {
			arr1[y] = n[o];
			arr2[y] = n2[o];
			y++;
		}
	}

	private static void mergeSort(int[] arr1 ,int[] arr2, int s , int e) {
		if(s >= e) {
			return;
		}
		else {
			int m = (s + e)/2;
			mergeSort(arr1 , arr2 , s , m);
			mergeSort(arr1 ,arr2 , m + 1 , e);
			merge(arr1 , arr2, s, e);
		}
	}

	public static void mergeSort(int[] input1 , int[] input2){
		// Write your code here
		mergeSort(input1, input2,  0, input1.length - 1);
	}

	public static void main(String args[]) {
		Scanner s = new Scanner(System.in);
		int n = s.nextInt();
		int k = s.nextInt();
		int arr[] = new int[n];
		int in[] = new int[n];
		for(int i = 0 ; i < n ; i++) {
			arr[i] = s.nextInt();
			in[i] = i + 1;
		}
	    mergeSort(arr, in);
	    String ans = "";
	    int i = 0;
	    int a = 0;
	    while(i < n) {
	    	if(arr[i] > k) {
	    		break;
	    	}else {
		    	a++;
		    	ans += in[i];
		    	k -= arr[i];
		    	i++;
	    	}
	    }
	    System.out.println(a);
	    for(int j = 0 ; j < ans.length() ; j++) {
	    	System.out.print(ans.charAt(j) + " ");
	    }
	    System.out.println();
	}
}

import java.util.Scanner;
import java.util.Arrays;

public class Main {
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        int n = s.nextInt(), t = s.nextInt(), d = 0;
        double l[] = new double[++n];
        for(int i = 1; i < n; i++) {
            l[i] = (double)s.nextInt() + (i / 10.0);
        }
        Arrays.sort(l);
        for(int i = 1; i < n && d < t; i++) {
            d += (int)l[i];
            if(d <= t) {
                int j = (int)((l[i]-(int)l[i])*10+0.000001);
                System.out.print(j+" ");
            }
        }
    }
}

import java.io.*;
import java.lang.reflect.Array;
import java.nio.Buffer;
import java.util.*;

public class Pair {

//    public static List<Boolean> candies(int[]arr,int x){
//
//    }

    public static void main(String[] args) throws Exception {
        try {
            Scanner sc = new Scanner(System.in);
            int a = sc.nextInt();
            int b = sc.nextInt();
            int s = sc.nextInt();
            if(s>=(a+b) && (s-a-b)%2==0){
                System.out.println("Yes");
            }
            else{
                System.out.println("No");
            }

        }
        catch (Exception e) {
        }
    }
}

import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner input =new Scanner(System.in);
        int n=input.nextInt();
        int k=input.nextInt();
        int []a=new int[n];
        int []l=new int [n];
        for(int i=0;i<n;i++){
           a[i]=input.nextInt();
           l[i]=a[i];}
        java.util.Arrays.sort(l);
        int i=0;
        int numofinstrum=0;
        while(k!=0&&i<n){
            if(k>=l[i]){
               k=k-l[i];
               numofinstrum++;}
            else
                break;
            i++;
         }
        System.out.println(numofinstrum);

        if(numofinstrum!=n&&numofinstrum!=0){
         for(int j=0;j<n;j++){
             int x=0;
         while(x!=numofinstrum){
              int ind=a[j];
              if(l[x]==ind){
                System.out.print((j+1)+" ");
                break;}
              x++;
             }
           }
        }
        else
            for(int j=1;j<=numofinstrum;j++)
                System.out.print(j+" ");
           System.out.println("");

    }
  }

import java.util.*;
public class music{
    public static void main(String[] args){
        Scanner inp = new Scanner(System.in);
        int n,days;
        int count=0;
        n= inp.nextInt();
        days = inp.nextInt();
        int[] arr = new int[n];
        int[] darr= new int[n];
        for(int i=0;i<n;i++){
            arr[i] = inp.nextInt();
            darr[i] = arr[i];
        }
        Arrays.sort(arr);
        for(int i=0;i<n;i++){
            days = days - arr[i];
            if(days>=0){
                count++;
            }
        }
        // System.out.println(count+" ");
        for(int i=0;i<count;i++){
            for(int j=0;j<n;j++){
                if(arr[i]==darr[j]){
                    System.out.print((j+1)+" ");
                    darr[j] = 0;
                }
            }
        }
        inp.close();

     }
}

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
//package Codeforces;

/**
 *
 * @author Administrator
 */
import java.util.Scanner;

public class c507A {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int k = in.nextInt();
        int[] a = new int[101];
        int[] cs = new int[101];
        for (int i = 1; i <= n; i++) {
            a[i] = in.nextInt();
            cs[i] = i;
        }
        int t;
        for (int i = 1; i < n; i++) {
            for (int j = i + 1; j <= n; j++) {
                if (a[i] > a[j]) {
                    t = a[i];
                    a[i] = a[j];
                    a[j] = t;
                    t = cs[i];
                    cs[i] = cs[j];
                    cs[j] = t;
                }
            }
        }
        int s = 0;
        int i = 0;
        while (s <= k && i < n) {
            s += a[++i];
        }
        System.out.println(i - 1);
        for (int j = 1; j <= i - 1; j++) {
            System.out.print(cs[j] + " ");
        }
    }
}

import java.util.Scanner;

public class AmrandMusic {

    public static void main(String[] args) {

        Scanner console=new Scanner(System.in);
        int n=console.nextInt();
        int k=console.nextInt();
        int arr[]=new int [n];
        int arr2[]=new int [n];
        int sum=0,count=0,i,index=0;

        for(i=0;i<arr.length;i++)
        {
            arr[i]=console.nextInt();
            arr2[i]=arr[i];
        }
        for(i=0;i<arr2.length;i++)
            for(int j=i;j<arr2.length;j++)
                if(arr2[i]>arr2[j]){
                int temp=arr2[i];
                arr2[i]=arr2[j];
                arr2[j]=temp;}
        for(i=0;i<arr2.length;i++)
        if(k>sum)
        {
            sum=sum+arr2[i];
            count++;
        }
        else
            if(sum==k)
            {
                i--;
                break;
            }
        else
        {
            i--;
            sum=sum-arr2[i-1];
            count--;
            break;
        }

         if(sum>k||k==0)
            System.out.println("0");
        else
         {
             System.out.println(count);
             for(int j=0;j<arr.length;j++)
             {for(int a=0;a<arr.length;a++)
                 if(arr[a]==arr2[index])
                 {
                     System.out.print((a+1)+" ");
                     index++;
                     if(index>=i)
                         break;
                 }
             if(index>=i)
                         break;}
         }
    }
}

import java.util.*;

public class A507 {

	public static class Pair implements Comparable<Pair>{
		int ind;
		int days;

		public Pair(int i, int d) {
			this.ind = i;
			this.days = d;
		}

		@Override
		public int compareTo(Pair o) {
			return this.days > o.days ? 1 : -1;
		}
	}
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);

		int n = scan.nextInt();
		int k = scan.nextInt();

		List<Pair> list = new ArrayList();

		for (int i = 1; i <= n; i++) {
			list.add(new Pair(i, scan.nextInt()));
		}

		Collections.sort(list);

		String ans = "";

		int sum = 0;
		int s = 0;
		for (int i = 0; i < n; i++) {
			sum += list.get(i).days;
			if (sum > k) {
				s = i;
				break;
			}

			ans += list.get(i).ind + " ";
		}
		ans = s + "\n" + ans;
		System.out.println(ans);
	}

}

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;
import java.util.TreeMap;
public class JavaApplication39 {
    public static void main(String[] args) {
        int n , k , a;
        ArrayList  list = new ArrayList();
        ArrayList  num = new ArrayList();
        ArrayList  ind = new ArrayList();

        Scanner in = new Scanner(System.in);
        n = in.nextInt();
        k = in.nextInt();
        for (int i = 1; i <= n; i++) {
            a = in.nextInt();
            num.add(a);
            ind.add(i);
        }
        for (int i = 0; i < n; i++) {
            int key = (int) num.get(i);

            if( key <= k){
                 k = k - key;
                 list.add(i+1);
            }

        }
        System.out.println(list.size());
        list.sort(null);
        for (int i = 0; i < list.size(); i++) {
            if( i == list.size()-1){
                System.out.println(list.get(i));
                return;
            }
            System.out.print(list.get(i) + " ");
        }
    }

}

import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Scanner;

/**
 *
 * @author Hartha
 */
public class Sdf {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {

        Scanner sin = new Scanner(System.in);
        int n = sin.nextInt(), k = sin.nextInt(), count = 0;
        int arr[] = new int[n];
        ArrayList<Integer> a = new ArrayList();
        String s = "";
        for(int i = 0 ;i < n; i++)
            arr[i] = sin.nextInt();
        Arrays.sort(arr);
        for(int i = 1; i <= n; i++)
        {
            k -= arr[i-1];
            if(k > -1)
            {
                s += i + " ";
                count++;
            }
            else
                break;
        }
        System.out.println(count);
        System.out.println(s);
    }
}