/*******************************************************************************************************************************************************************************************************************************************************************
********************************************************************************************************************************************************************************************************************************************************************

                                                                                                                                                                                                                                                                `
                                                                                                                                                                                                                                                                   `
                                                                                                                                                                                                                                                                   `
                                                                                                                                               .:!|%|;'.                                                                                                           `
                                                                                                                                             ;&#&!'..|##&:                                                                                                         `
                                                                                                                  ...                      '$@@;  .`. `%@%:                                                                                                        `
                                                                                                                :%@#%`                    '&#%'.`''''..;%&!                                                                                                        `
                                                                                                              .%#%:|&!                  `%#|`..'''`''`.:|$!                                                                                                        `
                                                                                                             `|$|. .!|:                :%@&:.`'`. .`'`.:|&|.                                                                                                       `
                                                                                                            `|@|`...:$$'              :$#&!``':.  .`'`.;%&|.                                                                                                       `
                                                                                                           '$@$'.''``|#&;.           |##%'.':'.   .`'`.:%&%.                                                                                                       `
                                                                                                           !@%:``'''`:$#@;.         ;@#%'``'`     .`'`.'|@$.                                                                                                       `
                                                                                                          `%$:.`'''''``!&#&'   .;%&##|```''.      .`'`.'!@&'                                                                                                       `
                                                                                                          '%%'.`'''''```:$#&|%$@#@$!'..`''`       .''```;&&'                                                                                                       `
                                                                                                          :%|'.`''''''```:|@#&$;'``.``'''`        .`'```:&&:                                                                                                       `
                                                                                                         :$&|'.`'''''''''``....`''''''''`         .`''`.`%$;                                                                                                       `
                                                                                                      .'|@#%:``'''``''''''''`''''``''''`.         .`''`.`!$|`                                                                                                      `
                                                                                                     ;&##$!'``''''''''''''''''''`''''''`.         .`''`.`;$$:.                                                                                                     `
                                                                                                 '!&#@|'...'''''''''''`''''''''''''''''''::`      .`'''```!$|`                                                                                                     `
                                                                                               :&##@%'..`''''''''''''''''''''''''''''''''''''.    .''''```;&&:                                                                                                     `
                                                                                           '|@#@|'. .':'''''''''''''''''''''''''''''''``'''''''...`'''''`.'$#|`                                                                                                    `
                                                                                       .';|@#&|' .`'''``'`''''''''''''''''''''''''''''''''```'''''''''''`.`%@$;                                                                                                    `
                                                                                .`':!%$&&&$;'`.`'''''```''`..``'''''''''''''''''''''''''''''''`''''''''''``!&#$`                                                                                                   `
                                                                 ...`':;!||%$&@###&%!'.   .`:'''''``.;%$$$&&%!'``''''''''''''''''''''''''''''''''''`''''''`'!&#|.                                                                                                  `
                                                             '|$&&&@@#@@&&&&$%|;'`...```'''''''''``'!%!'`:%###@!```'''''''''''''''''''''''''''''''''''''''``'|@&|`                                                                                                 `
                                                            `|#######$'...    .``'''''''''''''''`';$&: `!$#####&!'``'''''''''''''''''''''''''''''''''''''''`.:%##%:                                                                                                `
                                                            '%###@@&|`                    .``'''`'!$&: '$@#####|'```''''''''''''''''''''''''''''''''''''''''`.`%##@%'                                                                                              `
                                                            '%#%'``.                          .`'``:||;;|@##&%;`.`'''''''''''''''''''''''''''''''''''''''''''`.;$###$`                                                                                             `
                                                            `|@!                                .':'``'''`....`''''''`.``''''''''''''''''''''''''''''''''``''''`.;$##&!.                                                                                           `
                                                            .!@|.                                 `':'``````''''''`.      .`'''''''''''''''''''''''''''''''''''``.:%@#@!`                                                                                          `
                                                             ;@%`                                   `':'''''`''''.          .''''''''''''''''''''''''''''''''''''`.`;@##|`                                                                                         `
                                                             :&&;.                                    `''::'''''`             .''''''''''''''''''''''''''''''''''''`.:$@@%'                                                                                        `
                                                             `|&&;                                       ..``'''.              .`'''''''''''''''''''''''''''''''''''`.'%@@|.                                                                                       `
                                                              `$#&;.                                                             .`''''''''''''''''''''''''''''''''''..:%@$`                                                                                       `
                                                               :@##$;.                                                             .`''''''''''''''''''''''''''''''`````;&@:                                                                                       `
                                                               `%####|`                                                               ..``'''''''''''''''''''''''''''``.:$&;.           `'::''``.                                                                  `
                                                                 `%@####@%!`                                                              .`'''''''''''''''''''''''''``.'|&%'        :%&&$$$$$&&@&&&%!:`             .``.                                          `
                                                                  .!&######@&$$%||!!!!;:'.                                                .`''''''''''''''''''''''''''`.'|&$;.     .:%$%|!!|||||||%%$&&$%!;:''::;;!!|$$!'                                          `
                                                                    `|####&;':;!|||||!:`.                                                .``'''''''''''''''''''''''''``.'!&$;.    :|$||||||||||||||||||%%%%%%%$$%%%|%$%'                                           `
                                                                      `!&##@%;`                                                     .`''''''''''''''''''''''''''''''''`.`!$&!. .;$&$%|%%%%||||||||||||||||!!!!!!!!!%$!'                                            `
                                                                        .:!&##@%:`.                                                .''''''''''''''''''''''''''''''''''`.`;$&|'`|@@@&&&&@&&&$$%%||||||||||||!!!!!!|$$|`                                             `
                                                                           `:|&##@$%!'                                            .`'''''''''''''''''''''''''''''''```'':|$@&$%$$$&@@@&&@@@@@@&$%||||||!!!!!!!!%$&$!'                                              `
                                                                               '%@####@%;.                                       .`''''''''''''''''''''''''''''````';%&@@@@@@&$|!|%&&$%|||%$&@@@&$%|||||||||%$&&%;.                                                `
                                                                                 `:|&####$;.                                     `'''''''''''''''''''''''''''```:;|$&@&$%%%&@@&%||%&&$%|||||%%$@@@&$%%$$&&@@@@$;.                                                  `
                      .:!|!'                                                         `!%&@@%;::;:'.                             .''''''''''''''''''''''''```':!$#@&$%|!||||$&@&%||%&&%||!||||||%$$&@@@&%|;:`                                                       `
                    ;$@##@@##|.                                                       '|&$$$%%%$$%%|!;:''`.                     `'''`''''''''''''''''`'''':!%$&&$%|||||||||$&@@%||%&&%||||||||||||%$&&%:.                                                          `
                  '$#@|.   .|#&:                                                       :%&$|!!!!|||%%%$$%%%|!!;'`.             .'''''''''''''''''````':!|%$&&$%%|||||||||||%&@&%||%$$%||||||||||||||%&&%:.                                                         `
                 '$#%`      .|#&'         .....                                         .|@$|!!!!!!!!!!!!|||%%$$$$$$%!:'`.      `'``````````````'':!|$&&&$%||||||||||||||||%$@#@@@@#@$%%|||||||||||||||$&&|`                                                       `
                .|@@!        :&@;                                                      `!%$&&$%|!!!!!!!!!!!!!!!||||%%$$$$%|!:''::::::::::;;;!!!!|%%$$$%|||||||||||||||||%%%$&&$%%%%%&@@$$%||||||||||||||%%$%!'.                                                    `
                `%#&:        .|##$;`.      ...                   :!%%%%%$$$%%%%$&@@@@@####@&@&$%!!!!!!!!!!!!!!!!!!!!!||%%%%$$$$$$$$$$$$$$$$$$$%%%%|||||||||||||||||%%%$$&&&|;;;;::::;%@@@&$%|||||||||||||||%%%|!;:':;;'.                                           `
                '$#|.          :$@###########################@@&@@@@@&&$$$$$$$$$%%$$&$$$&&%|%&&$||!!!!!!!!!!!!!!!!!!!!!!!!||||||||||%%%||||||||||||||||||||||||%$$&&&&&&$!:'''':!;;::';%@@&%|||||||||||||||!!||%$&@@%'                                             `
                '&#!.                   ...``````'''''''`'''';!%&&|''''''''''''''''''''''::::%&$%%|!!!!!!!!!!!!!!!!!!!!!!!!||||||||||||||||||||||||||||||||%%$&&&$$&&&%!:'``''':::::'``;%&@$%||||||||!||||||%$&@&%!'.                                              `
                .%#$'                                          ;&@|:''''''''''''''''''''''''';%$$%%|!!!!!!!!|||!!!!!!!!!!||||||||||||||||||||||||||||||%$$&@@@&$$&@&|:';!;:''''::''''''';$&&&&$$%%%%%%%$$$&@@&%'                                                   `
                '$#@|`                                         ;&@|:''''''''''''''''''''''''':!$&$%%|!!!!!!!!!!!!!!!!!!!!!!||||||||||||||||||||||||%%$$&&&&&&&&&&$|;::::::::'''''''''''`';%&@&&&&&&&$&&@&&&@#&:                                                    `
             `';;%@#@%`                                        ;&@|:'''''''''''''''''''''''''':%@&$$%|!!!!!!!!!!!!!!!!|||||||||||||||||||||||||%%$$&&&&$$$$&&$$|;:'``''''''::''''''''''``.';!!!!!!;;:;:'`.`!&@|`                                                   `
            `:;;;:;!$@#@%;`                                    :&@|:'''''''''''''''''''''''''``;%&&$$%|!!!!!!!!!!!!!!!|||%%%$$$$$$$$%%%%%%$$$&&&&&&$$%%$&@&%%@#$!!;:`'''''''''''''''''''''`''''''''''''':!$@##&`                                                   `
            .':;;;;:::!%&###@&|'                              .!@@|:''''''''''''''''''''''''''`';%&&&$%||!!!!!!!!!!!!!!!!||||%%%$$$$$$$$$$&&$$$$%%||%&&&$%%%$@#@$%&&@#$!:''''''''''''::::'::::::::::!$@#####@;                                                     `
            .`::;;;;;:::::;!%$@##@@%;.                         ;@@|'''''''''''''''''''''''''''''';%&@&$$%||!!!!!!!!!!!!!!!!!!||||||||%%%%%%%%||||%$&&$$$$$$$$@#@%!;%@@@#@&|:'''''::::'''':::::;!%&@###&|;|&#$`                                                     `
            .'::;;;;;;;:::::::::;|&@###@$|:`                   :&@|:''''''''''''''''''''''''::':;%@@@@@&$$%|!!!!|!!!!!!||!!||||||||||||||||||||%&&&&$$$$$$$%$@#@%!;!$#####@#&!''::''''':;|&@######&;.     !#$`                                                     `
            .'::;;;;;;::::::::::`     '!$@####@&%;`.           ;&@%:''''''''''''''''''''''''''':!%$$$&&&&&$%%||!!!!!!!!|||||||!|||||||||||||||%&@&$&&$$$$$$%$@#@|;;|$@@; `|&##@&|::;|$&@####$;`          `|@%`                                                     `
            .'::;;;;;;:::::::::::'`.         `'!$@###@@&%;`   .!@#$;'''''''''''''''''''''''':'';%&@&$$$&&&&&$$%%|!!!!||!!!|||||||||||||||||||$@&&&$$$$$$$$$%$@#&!::!%@@|.     :&#######@%;.              `$@!                                                      `
            .':::;;;:;;;:::::::::'``...             `!$@@####@@@@#$:'''''''''''''''''''''''':'';%@@$$$$$$$$&&&&$%%|||!!||||||||||||||||||||$&&&&#@$$$$$$$$%$&##$!:';%&#%.       '$@@|.  .                |#$`                                                      `
            `':::;;;;;::::::::::''```..  ...              .'!|&###%:'''''''''''''''''''''''''''!&#@$$$$$$%%&@@&@@&$%%|||!|||||||||||||||||%&&%!$#@$$$$$$$$%$&##$!:';%@@;         !@&:                   ;@&;                                                       `
            `':::;::;;;:::::::''''``....                       !@#%:'''''''''''''''''''''''''''!&@&$$$$$$$$@&|:!%&&@&$%%|||||||||||||||||$&$!``%#&$$$$$$$$$$&##$!:':|@@;        ;@@;                   !@&;                                                        `
            `':::;;;;;::::::::'''```.. .                       `$#&;'''''''''''''''''''''''''''|@#&$$$$$$$&@$;''':;|$&&$$%%||||||||||||%&@$;'';$#&$$$$$$$$$$&##$;'':|@@;       !@@;                  '&#&:                                                         `
            `''::::::::::::::''''``...                          `$#@&%|;::::::::::::::::'''''':%##&$$$$$$$$@&;'':''':!$&&&$$%||||||%%$&&%;'''';&#&$$$$%$$$$$@##$;:':|@&:      !@@;                  ;@#$'                                                          `
            `''::::::::::::::''''``...                            :$##@@@@@@@@&&&&&&&@&&$%|!;:;$##&$$$$$$$$&|'':::''''';%&&$$$$%%%$&&%!:''''''!&#&$$$$$$$$$$&##%;:':|@&'    `$#$`                 .|#@!                                                            `
            .`''::::::::::::''''````..                               .....';|%$&@@@@@@@####@$|!&#@$$$$$$$$$&!''::''''''':|$&&$$&@&$!;:'''''''';$#&$$$$$$$$$%&##%:'':%@@:   :&@;                  ;&#$`                                                             `
            .``'':::::::::''''''```...                                                 '%###$|!&#@$$$$$$$$$$!''::''''''''`'|&@#$;'`''''''''''';$#@$%%$$$$$$$&#@|:'':%@&'  !@&:                `|@#|.                                                               `
            .``'''::::::::'''''```...                                                   :&#@$||@#&$$$$$$$$&&!''''''''''''''':;;''''''''''''''';$#@$$%$$$$$$$&#@|:':;%@#$%&#%.               `%@#$'                                                                 `
            ..``'''''::::''''''``....                                                   '$#@%%%@#&$$$$$$$$&&|'':'''''''''''''''''''''''''''''':%#@$$%%$$$$$$&#@|;!|$@####&:               `%@#&:                                                                   `
            ..```''''''''''''````...                                                    `%#&%%$@#&$$$$$$$$&@|'':'''''''''''''''''''''''''''''':%#@$$%%$$$$$$@#@$$&##@!.                 .|@#@!                                                                     `
             ..```''''''''``````...                                                     `%#&||$##&$$$$$$$$&&|:'''''''''''''''''''''''''''''''':$#@$$%%$$$$%$@##@##&:                  .|@#@;                                                                       `
             ...``````````````...                                                       `$@&|%&##&$$$$$$$$&@|''''''''''''''''''''''''''''''''';$#@$$$$%$$%%&####&;                  .|@#$'                                                                         `
              ....`````````.....                                                        '$@$|$&##&$$$$$$$$&@|''''''''''''''''''''''''''''''''';&#@$$$$%$$$$$&##@!                 .|@#$`                                                                           `
                ...............                                                         ;&@$|$@#@$$$$$$$$$&@%:'''''''''''''''''''''''''''''''';&#@$$$$$$$$$$&##&:        `      .|@#|.                                                                             `
                   .......                                                              !@@%|&##@$$$$$$$$$@@|''''''''''''''''''''''''''''''''';&#&$%%$$$$$$$&##@!.        .```.`:$@#%.                                                                             `
                                                                                       .|#&%|&##&$$$$$$$$$@&;''''''''''''''''''''''''''''''''':$#&$%%$$$$$$%&##@;               `|@@|                                                                              `
                                                                                       '$#&||&##&$$$$$$$$&@$:''''''''''''''''''''''''''''''''':%@&$%%$$$$$$%&###&;           ...`!@#%.                                                                             `
                                                                                       ;&@$!|&##&$$$$$$$$&#$:''''''''''''''''''''''''''''''''':$#&$$$$$$$$%$&#####$:             ;@#&`                                                                             `
                                                                                       !@@%;|&#@$$$$$$$$$&#$:''''''''''''''''''''''''''''''''':$#&$$$$$$$$$$@##&%%@######@$||$&@##$'                                                                               `
                                                                                       !@@|;|&#&$$$$$$$$$&#$:''''''''''''''''''''''''''''''''':%#@$$$$%$$$$$@#@|:'':;%@&&&@@@&%!'                                                                                  `
                                                                                       !@@!:|@#&$$$$$$$$$@#%:''''''''''''''''''''''''''''''''''|@@$$$$$$$$$$@#@!:''``|@;                                                                                           `
                                                                                       !&%::|&#@$$$$%$$$$@#|'''''''''''''''''''''''''''''''''':%##$$$$$$$$$&@#@|:::``%@!                                                                                           `
                                                                                       `''``:!|%$%|!!!!!||%|;''`..````.````````````````''''''';|%%||!!;;!!|%%%|:`   .%@!                                                                                           `
                                                                                                                                                                                                                                                                   `
                                                                                                                                                                                                                                                                   `
                                                                                                                                                                                                                                                                   `
                                                                                                                                                                                                                                                                   `
                                                                                                                                                                                                                                                                   `
                                                                                    .                                                                             .`.                                                                                              `
                                                         ......:!:. ...           `|$'         `%|'!%!;|%$$$$$$:    `|$%%$$$$$$%$$%'   :$%%%%%%$$$%%$$%$|.        :$$;;;;;'                         .!%`   .........                                               `
                                                        ':;!!!|$%!!!!!;'.  `|%|!!!|%$%!!!!|!.  .:$@$;.    '%$;`     '%|'`.`%@;.`'%&:    .     `|%:     ..    ````';&$:':::'`.                        ;|`  :%$&&$%%&@!                                              `
                                                          .;!::;;:':|!.    '&$;::'. `;!'..;|`  ;%%%!;;|%%%$&%%%|;`  '%%;:':$@!':;$&:         `||'.          '$$;:;|$%;;!!:!%;.                      .;|'``. .!!.  :&!                                              `
                                                          `%@&&&&&&&@$`      ..'!%%:`;;`       ..`;$%`  .`!!`       `|!'``'%&;``'%&:       `;|&%`:%%;.      `$&|%$&@&|;;:`'`                      `%&&$!;;` .%%. `;%:                                              `
                                                          `||::''':;%%`      :%!'`` `!:         .;&#$` `:$&;...      ':'::|%!:::::'.     .:%|':|`  :|!'     '%%. .'!|:'';|!.  .!$%%%%%%%%%%%%%%!`    ;!.    `$%. `;!'                                              `
                                                          `%@&&&&&&&@%`    `;;;!!;'`:%!'`'':'  ;&%;$$;%|!$&%%!!!.  .:%$%%$&@&$%%%$%!'  :%$%'  '!'   .|&|'  .:|!.  `||:!!'.                           :!..;:`;$!  `;!'                                              `
                                                       `::;|!;:::::;|%;:;` .`''''':%&|;:'''``  ''.`%$!$!`$%!&;'!`    .. `;%!. ...;%!'  `'.    '!'     .    '!!;!|''$|'!;':!;.                       .|&$|!:|$;.  `;!'                                              `
                                                        .``;%%!'.'!%$!:`.      `:!||:'!%%!:.     '|%|!&|:$$|&!;|:     .'!$%`     !&;.         '!'          !&:.:|:'&|'!;:;;`                        .;;``:||:  .:%$;`                                              `
                                                       .:$&!'.     .`!@%'  '$@@$!'.     `!$%'  '$#&;'|%%|%%%%||%|' ;$&&%!`    .%@&%'          :|'         '%%`'&#@@##@@@@@@#$`                         `|@%.  .%@$;.                                               `
                                                                                                                                                                                                                                                                   `
                                                                                                                                                                                                                                                                   `
                                                                                                                                                                                                                                                                   `
                                                                                                                                                                                                                                                                   `
                                                                                                                                                                                                                                                                   `
********************************************************************************************************************************************************************************************************************************************************************
*******************************************************************************************************************************************************************************************************************************************************************/
/*********************
*@Author:   CKang    *
*@Language: C++11    *
*********************/
#include<bits/stdc++.h>
#pragma comment(linker, "/STACK:102400000,102400000")
//#define DEBUG
#define RI register int
#define endl "\n"

using namespace std;

typedef long long ll;
//typedef __int128 lll;
//const int N=100000+10;
const int M=100000+10;
const int MOD=1e9+7;
const double PI = acos(-1.0);
const double EXP = 1E-9;
const int INF = 0x3fffffff;
const ll LINF = 0x3fffffffffffffff;

inline ll read(){
    long long x=0,f=1;
    char ch=getchar();
    while(ch<'0'||ch>'9'){
        if(ch=='-')
            f=-1;
        ch=getchar();
    }
    while(ch>='0'&&ch<='9'){
        x=(x<<1)+(x<<3)+(ch^48);
        ch=getchar();
    }
    return x*f;
}

int nums[200005]={0};int mp[200005]={0};

void solve(){
    ll n=read(),k=read(),city=1,cir=0,fir;
    for(int i=1;i<=n;i++)nums[i]=read();
    for(;;){
        mp[city]++;
        if(mp[city]==3){
            fir=city;
            break;
        }
        if(mp[city]==2){
            cir++;
        }
        if(mp[city]==1){
            k--;
            if(k==0){
                cout<<nums[city]<<endl;
                return ;
            }
        }
        city=nums[city];
    }
    k=k%cir;
    while(k){
        fir=nums[fir];
        k--;
    }
    cout<<fir<<endl;
    return ;
}

int main()
{
#ifdef DEBUG
    freopen("input.in", "r", stdin);
    //freopen("output.out", "w", stdout)
#endif
    //cout.tie(0);
    //for(ll t=read();t;t--)
        solve();
#ifdef DEBUG
    printf("Time cost : %lf s\n",(double)clock()/CLOCKS_PER_SEC);
#endif
    //cout << "Fuck You !" << endl;
    return 0;
}


Measured memory_bytes: 5192