void setup () {
int []K = {
4, 8, 5
}; //your array
int []R = {
0, 1, 2
}; //array of index
int n = 4;//number you want to know
int a = 0;
for (int i = 0; i<K.length; i++) {
if (n==K[i]) {
println(K[i]+" has index = " +R[i]+" in K") ;
a=a+K.length;//N
} else if (n!=K[i])
a=a-1;
}
if (a<=-1) {
println(n+" is not in K");
}
}