What joy! Petya's parents went on a business trip for the whole year and the playful kid is left all by himself. Petya got absolutely happy. He jumped on the bed and threw pillows all day long, until... 

Today Petya opened the cupboard and found a scary note there. His parents had left him with duties: he should water their favourite flower all year, each day, in the morning, in the afternoon and in the evening. "Wait a second!" — thought Petya. He know for a fact that if he fulfills the parents' task in the i-th (1 ≤ i ≤ 12) month of the year, then the flower will grow by ai centimeters, and if he doesn't water the flower in the i-th month, then the flower won't grow this month. Petya also knows that try as he might, his parents won't believe that he has been watering the flower if it grows strictly less than by k centimeters. 

Help Petya choose the minimum number of months when he will water the flower, given that the flower should grow no less than by k centimeters.

Input

The first line contains exactly one integer k (0 ≤ k ≤ 100). The next line contains twelve space-separated integers: the i-th (1 ≤ i ≤ 12) number in the line represents ai (0 ≤ ai ≤ 100). 

Output

Print the only integer — the minimum number of months when Petya has to water the flower so that the flower grows no less than by k centimeters. If the flower can't grow by k centimeters in a year, print -1.

Examples

Input

5
1 1 1 1 2 2 3 2 2 1 1 1


Output

2


Input

0
0 0 0 0 0 0 0 1 1 2 3 0


Output

0


Input

11
1 1 4 1 1 5 1 1 4 1 1 1


Output

3

Note

Let's consider the first sample test. There it is enough to water the flower during the seventh and the ninth month. Then the flower grows by exactly five centimeters.

In the second sample Petya's parents will believe him even if the flower doesn't grow at all (k = 0). So, it is possible for Petya not to water the flower at all.


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

public class P149A {
    //static long m=1000000007;
    static BigInteger ways(int N,  int K) {
        BigInteger ret = BigInteger.ONE;
        for(int i=N;i>=N-K+1;i--)
        {
             ret = ret.multiply(BigInteger.valueOf(i));
            
        }
        for (int j = 1; j<=K; j++) {
            ret = ret.divide(BigInteger.valueOf(j));
        }
       
            ret=ret.mod(BigInteger.valueOf(1000000007));
        
        return ret;
    }
    public static int prime(int n)
    {
        int f=1;
        if(n==1)
            return 0;
        for(int i=2;i<=(Math.sqrt(n));)
        {
            if(n%i==0)
            {
                f=0;
                break;
            }
            if(i==2)
                i++;
            else
                i+=2;
        }
        if(f==1)
            return 1;
        else 
            return 0;
    }
/*public static long gcd(long x,long y)
{
    if(x%y==0)
        return y;
    else return gcd(y,x%y);
}*/
    public static BigInteger fact(int n)
    {
        BigInteger f=BigInteger.ONE;
        for(int i=1;i<=n;i++)
        {
            f=f.multiply(BigInteger.valueOf(i));
        }
        //f=f.mod(BigInteger.valueOf(m));
        return f;
    }
public static int gcd(int x,int y)
{
    if(x%y==0)
        return y;
    else return gcd(y,x%y);
}
public static int max(int a,int b)
{
    if(a>b)
        return a;
    else
        return b;
}
public static int min(int a,int b)
{
    if(a>b)
        return b;
    else 
        return a;
}
static int knapsack(int wt[], int W, int n)
{
  int i, w;
  int K[][]=new int[n+1][W+1];

  // Build table K[][] in bottom up manner
  for (i = 0; i <= n; i++)
  {
      for (w = 0; w <= W; w++)
      {
          if (i==0 || w==0)
              K[i][w] = 0;
          else if (wt[i-1] <= w)
                K[i][w] = (int)Math.max(wt[i-1] + K[i][w-wt[i-1]],  K[i-1][w]);
          else
                K[i][w] = K[i-1][w];
      }
  }

  return K[n][W];
}
   static int knapsack1(int arr[],int sum,int n) 
   { 
       if(n<0)
           return 0; 
       if(sum-arr[n]<0) 
           return knapsack(arr,sum,n-1); 
       return (int)Math.max(knapsack(arr,sum-arr[n],n)+arr[n],knapsack(arr,sum,n-1)); 
   }
   static void LCSLength1(char x[],char y[],int m,int n)
   {
   int c[][]=new int[m+1][n+1];
   for(int i=0;i<=m;i++)
       {
       c[i][0]=0;     
   }
   for(int i=0;i<=n;i++)
       {
       c[0][i]=0;    
   }
   for(int i=1;i<=m;i++)
       {
       for(int j=1;j<=n;j++)
           {
           if(x[i-1]==y[j-1])
           {
               c[i][j]=c[i-1][j-1]+1;
           }
           else
               c[i][j]=(int)Math.max(c[i][j-1],c[i-1][j]);
       }
   }
  
      // Following code is used to print LCS
  int index = c[m][n];

  // Create a character array to store the lcs string
  char lcs[]=new char[index+1];
 lcs[index] = '\0'; // Set the terminating character

  // Start from the right-most-bottom-most corner and
  // one by one store characters in lcs[]
  int i = m, j = n;
  while (i > 0 && j > 0)
  {
     // If current character in X[] and Y are same, then
     // current character is part of LCS
     if (x[i-1] == y[j-1])
     {
         lcs[index-1] = x[i-1]; // Put current character in result
      
         i--; 
         j--; 
         index--;     // reduce values of i, j and index
     }

     // If not same, then find the larger of two and
     // go in the direction of larger value
     else if (c[i-1][j] > c[i][j-1])
        i--;
     else
        j--;
  }
for(i=0;i<c[m][n];i++)
  System.out.print(lcs[i]+" ");

}
   static int LCSLength(char x[],char y[],int m,int n)
   {
   int c[][]=new int[m+1][n+1];
   for(int i=0;i<=m;i++)
       {
       c[i][0]=0;     
   }
   for(int i=0;i<=n;i++)
       {
       c[0][i]=0;    
   }
   for(int i=1;i<=m;i++)
       {
       for(int j=1;j<=n;j++)
           {
           if(x[i-1]==y[j-1])
               c[i][j]=c[i-1][j-1]+1;
           else
               c[i][j]=(int)Math.max(c[i][j-1],c[i-1][j]);
       }
   }
   return c[m][n];
}
   static int lis( int a[], int n )
   {
      int[] m = new int[n+1];
        int l = 0;
        for (int i = 0; i < n; i++) 
        {
          int lo = 1, hi = l+1;
          while (lo<hi) 
          {
            int mid = (lo+hi) / 2;
            if (a[m[mid]] < a[i])
                lo = mid+1;
            else 
                hi = mid;
          }
          
          m[lo] = i;
          l = Math.max(l, lo);
     
       
    }
        return l;
   }
    public static void main(String[] args) throws Exception{
        
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        StringBuilder sb=new StringBuilder("");
        //int t=Integer.parseInt(br.readLine());
    //  while(t-->0)
        //{
        //int n=Integer.parseInt(br.readLine());
        //long n=Long.parseLong(br.readLine());
        //String l[]=br.readLine().split(" ");
        //int m=Integer.parseInt(l[0]);
        //int k=Integer.parseInt(l[1]);
        //l=br.readLine().split(" ");
        //long m=Long.parseLong(l[0]);
        //long n=Long.parseLong(l[1]);
        //char ch=a.charAt();
    //  char c[]=new char[n];
        /*int a[]=new int[n];
        for(int i=0;i<n;i++)
        {
            a[i]=Integer.parseInt(l[i]);
        }*/
        /*long a[]=new long[n];
        for(int i=0;i<n;i++)
        {
            a[i]=Long.parseLong(l[i]);
        }*/
        /*int a[][]=new int[n][n];
        for(int i=0;i<n;i++)
        {
        l=br.readLine().split(" ");
            for(int j=0;j<n;j++)
            {
                a[i][j]=Long.parseLong(l[j]);
            }
        }*/
        
        //  String a=br.readLine();
        
        // char a[]=c.toCharArray();
        //char ch=l[0].charAt(0);
        
        //HashMap<Integer,Integer>hm=new HashMap<Integer,Integer>();
        //HashMap<Integer,String>hm=new HashMap<Integer,String>();
        //HashMap<Integer,Long>hm=new HashMap<Integer,Long>();
        //hm.put(1,1);
        //HashSet<Integer>hs=new HashSet<Integer>();
        //HashSet<Long>hs=new HashSet<Long>();
        //HashSet<String>hs=new HashSet<String>();
        //hs.add(x);
        //Stack<Integer>s=new Stack<Integer>();
        //s.push(x);
        //s.pop(x);
        //Queue<Integer>q=new LinkedList<Integer>();
        //q.add(x);
        //q.remove(x);
        //ArrayList<Integer>ar=new ArrayList<Integer>();
        //long x=Long.parseLong(l[0]);
        
        //int min=100000000;
    
        //long c1=(long)Math.ceil(n/(double)a);
        //Arrays.sort(a);
          // int f1[]=new int[26];
           //int f2[]=new int[26];
        /*for(int i=0;i<n;i++)
        {
        int x=a.charAt(0);
            f1[x-97]++;
        }*/
        /*for(int i=0;i<n;i++)
        {
            
        }*/
        /*for(int i=0;i<n;i++)
        {
            for(int j=0;j<n;j++)
            {
                
            }
        }*/
        /*while(q--)
          {
                l=br.readLine().split(" ");
                int n=Integer.parseInt(l[0]);
                int k=Integer.parseInt(l[1]);
          }
         */
        /*if(f==1)
            System.out.println("Yes");
        else
            System.out.println("No");*/
        //System.out.print("");
        //sb.append("");
        //sb.append("").append("\n");
        int k=Integer.parseInt(br.readLine());
        int n=12;
        int a[]=new int[n];
        int c=0;
        String l[]=br.readLine().split(" ");
        for(int i=0;i<n;i++)
        {
            a[i]=Integer.parseInt(l[i]);
        }
        Arrays.sort(a);
        int e=0;
        for(int i=n-1;i>=0;i--)
        {
            if(c>=k)
            {
                break;
            }
            c+=a[i];
            e++;
        }
        if(c<k)
            System.out.println("-1");
        else
           System.out.println(e);           
        
        //}
    }
}