#include <iostream>
#include <iomanip>
#include <math.h>
using namespace std;

int main()
{
  int K,N;
  int p[1000];
  int tmp;
  int sum=0;

  cin >> K >> N;

  for(int i=0; i<N; ++i)
  {
    cin >> p[i];
  }

  for(int i=0; i<N; ++i)
  {
    for(int j=0; j<N-1; ++j)
    {
      if(p[i] > p[i+1])
      {
        tmp = p[i];
        p[i] = p[i+1];
        p[i+1] = tmp;
      }
    }
  }

  for(int i=0; i<K; ++i)
  {
    sum += p[i];
  }

  cout << p[i] << endl;

  //cout << fixed << setprecision(8) << s << " " << l << " " << endl;

  return 0;
}

