#include <stdio.h>

int main(void) {
    
    long long N, K;
    scanf("%lld", &N); scanf("%lld", &K);

    int towns[N];
    for (int i=0; i<N; i++) {
        scanf("%d", &towns[i]);
    }

    printf("%d\n", towns[(K)%3]);

}