#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, s = 0, r = 0;
  int a[10];
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  cin >> m;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n - 1; j++) {
      if (a[j] > a[j + 1]) {
        r = a[j + 1];
        a[j + 1] = a[j];
        a[j] = r;
      }
    }
  }
  for (int i = 1; i <= n; i++) {
    if (i <= m) {
      s = s + a[i];
    }
  }
  cout << s;
  return 0;
}
