#import <stdio.h>
#import <stdlib.h>
#import <string.h>
#define MAXLEN 5005
#define MIN(a,b) ((a)<(b)?(a):(b))

int compare_str(const void *a, const void *b) {
    return strcmp(*(char**)a, *(char**)b);
}

int main() {
    char S[MAXLEN] = {'\0'};
    int K;
    scanf("%s %d", S, &K);
    long L = strlen(S);
    if (L==1) {
        printf("%s", S);
        return 0;
    }
    
    long N = L*(L+1)/2;
    char **substrs = (char**)malloc(N * sizeof(char*));
    char *baseMatrix = (char*)malloc(N * MAXLEN * sizeof(char));
    
    for (long i=0; i<N; i++) {
        substrs[i] = baseMatrix + i * MAXLEN;
    }

    long count = 0;
    for (long i=0;i<L;i++) {
        for (long j=i;j<MIN(L,i+6);j++) {
            strncpy(substrs[count], S+i, j-i+1);
            count++;
        }
    }
    
    qsort(substrs, N, sizeof(char*), compare_str);

    char *prev = "";
    count = 0;
    for (long i=0; i<N; i++) {
        if (substrs[i][0] == '\0' || strcmp(prev, substrs[i])==0) {
            continue;
        }
        count++;
        if (count == K) {
            printf("%s", substrs[i]);
            return 0;
        }
        prev = substrs[i];
    }
}
